Python

Difference between version 74 and 75 - Previous - Next
'''[http://www.python.org/%|%Python]''' is an [Open Source%|%open-source]
[scripting language%|%scripting] and general programming language, 
often used for rapid application development.  


** Attributes **

   current versions:   
   * [https://www.python.org/downloads/release/python-374/ %|% Python 3.7.4 2019-07-08]
   * [https://www.python.org/downloads/release/python-2716/ %|% Python 2.7.16 2019-03-04]

   contact:   g u i d o at C N R I dot R e s t o n dot V A dot U S (Guido van Rossum)

   contact:   f r e d r i k dot l u n d h at i m a g e dot c o m b i t e c h dot s e (Fredrik Lundh)



** See Also **

   [http://www.python.org/about/%|%about Python]:   

   [http://www.computerworld.com/s/article/101390/Python?nlid=APP%|%QuickStudy: Python] ,Russel Kay ,2005-05-02:   

   [http://wiki.python.org/moin/PythonBooks%|%Python Books]:   

   [IDLE]:   

   [Tkinter]:   

   [Tcl Equivalents of Python Modules]:   

   [http://ironpython.codeplex.com/%|%IronPython]:   an implementation of Python in [.NET]

   news:comp.lang.python:   a [USENET] interface to the Python mailing list

   [Comparing Tcl with Python]:   

   [Accessing Tcl and Python from one another]:   

   [Tcl vs Perl vs Python]:   

   [Playing Python]:   

   [http://avc.inrim.it/%|%AVC — Application View Controller]:   a multiplatform, fully automatic, live connection among graphical interface widgets and application variables for the Python language.

   [http://www.phaseit.net/claird/comp.lang.python/python.html%|%Cameron Laird's personal notes on Python] ,by [CL%|%Cameron Laird]:   

   [http://effbot.org/tkinterbook/%|%An Introduction to Tkinter (Work in Progress)]:   last updated in 2005.

   [http://web.archive.org/web/20110606080918/http://www.ibm.com/developerworks/linux/library/l-qt/?ca=dgr-linuxw02QTPyQT%|%Qt and PyQt] ,Boudewijn Rempt and David Mertz ,2003-02-11:   alternative to [Tkinter]

   [https://web.archive.org/web/20080607015636/http://tcltk.gtcs.com/articles/BASIC_today/%|%BASIC Comuter Use Today] ,by [Bruce Gingery] (b g i n g e r y at g t c s dot c o m:   an article that compares Tcl/Tk, Perl/Tk, and Python/Tk to early 1980's BASIC using a simple example

   [http://www.cl.cam.ac.uk/~fms27/ipc7/%|%7th International Python Conference ,Trip report] (alternative: [https://web.archive.org/web/20050308151610/http://www-lce.eng.cam.ac.uk/~fms27/ipc7/]) , by [Frank Stajano] []:   in which Frank coins the the Pytho logo, "batteries included"

   [http://www.cl.cam.ac.uk/~fms27/ipc7/tr-1998-9.html%|%Implementing the SMS server, or why I switched from Tcl to Python] ,[Frank Stajano]:   "[incr Tcl] offers a more complete and much-cleaner object-oriented support than Python".  Too bad Frank didn't stick around for [TclOO]!  "I prefer Python because its standard library is a gold mine."

   [http://www.python.org/topics/yisl2002.html%|%The Year In Scripting Languages Lua/Perl/Python/Ruby/Tcl] ,Mitchell Charity ,2003-01:   an historically-interesting summary of scripting language developments in 2002.

   [http://www.computerworld.com/s/article/101372/Sidebar_Zope_Spurs_Python_Growth?nlid=APP%|%Sidebar: Zope Spurs Python growth] ,Russel Kay ,2005-05-02:   The popularity of Zope (Z Object Publishing Environment), an open-source Web application server and portal tool kit written in Python, has increased interest in the programming language.

   [An empirical comparison of C, C++, Java, Perl, Python, Ress, and Tcl, by Lutz Prechelt ,2000-03-10]:   



** Tools **

   [critlib]'s Typcl:   an extension to use Tcl *from* Python.  It doesn't really require CriTcl and could have been done in standard C.

   [Elmer]:   [Elmer] allows developers to write code in Python and execute it in Tcl.  The resulting Tcl interface to the Python code generated by [Elmer] is transparent to the Tcl user... Python calls appear as Tcl calls ( "foo( 1, "a" )" in Python appears as "foo 1 a" in Tcl, for example) and Python and Tcl data types are automatically mapped (Tcl lists are converted to Python lists, Python dictionaries are returned as Tcl associative arrays, etc.). [Elmer] also supports Python's "freeze" module, allowing a Python developer to deliver a single library consisting of several Python files "frozen" in to the Tcl application... no need to set PYTHONPATH or have Python source files accompanying the Tcl application.

   https://github.com/aidanhs/libtclpy%|%libtclpy%|%:   a Tcl extension to call Python from inside Tcl. The intention is to take the good parts of Elmer and tclpython and combine them to let you get going as fast as possible.


** Description **

Python includes a standard facility for object-oriented programming. 

[Tcl] is bundled into Python in order to make [Tk] available as the Python module, '''Tkinter'''.  
Beginning at version v1.5.2, includes [IDLE], an integrated development environment 
for Python that requires [Tkinter].  
Python 2.4 not only supports [Tk] on [Unix], but Tk on Windows and [Macintosh] platforms as well.

An example of converting a Tcl list to a Python tuple:

======
#! /bin/env python

import Tkinter
tcl = Tkinter.Tcl()
result = tcl.call('lrange' ,'''one {two and} three''' ,0 ,'end')
======

To evaluate a Tcl script:

======
#! /bin/env python

import Tkinter
tcl = Tkinter.Tcl()
result = tcl.eval('some Tcl script here')
======


[ActiveState] provides [http://www.activestate.com/activepython%|%Active
Python] binary downloads for [Linux], [Solaris] and [Windows].

[http://code.enthought.com/enthon%|%Python, Enthought Edition], now [https://www.enthought.com/products/canopy/%|%Enthought Canopy], provides Python+packages bundle.



** Misc **

[AMG]: Does anyone have [Tcl] code to read [Python] pickle
[http://docs.python.org/library/pickle.html] data?  Tcl pickle, heh. 
Maybe someday I might develop it, if no one else has already done so.

-----
"a Python script can be expected to work for two to three years, but not for five or more. Older scripts will either crash, which is a nuisance, or produce different results, which is much worse because the problem may well go unnoticed." [http://blog.khinsen.net/posts/2017/11/16/a-plea-for-stability-in-the-scipy-ecosystem/]

-----
The Art of dividing two numbers in Python:

======
% Python 2.7
>>> 5 / 2
2

% Python 3.x
>>> 5 / 2
2.5

% Python 2.7
>>> from __future__ import division
...
>>> 5 / 2
2.5

% Python 2.7/3.x
>>> 5 // 2
2
>>> 1 / 0.2
5
>>> 1 // 0.2
4
======----
'''[arjen] - 2019-08-30 07:43:20'''

What exactly is the difference between / and // in Python? I could imagine what is going on in the first few examples, but "1//0.2" resulting in "4" really makes me wonder ...

<<categories>> Language | Object Orientation