JDT

 

John Dixon
Technology
Limited

 
Google

Introduction to Python


Python is a general-purpose, very high-level programming language. Its design philosophy emphasizes programmer productivity and code readability. Python's core syntax and semantics are minimalist, while the standard library is large and comprehensive.

Python supports multiple programming paradigms (primarily object oriented, imperative, and functional) and features a fully dynamic type system and automatic memory management; similar to Perl, Ruby, Scheme, and TCL.

Python was first released by Guido van Rossum in 1991. The language has an open, community-based development model managed by the non-profit Python Software Foundation. While various parts of the language have formal specifications and standards, the language as a whole is not formally specified. The de facto standard for the language is the CPython implementation.

History

Python was conceived in the late 1980s by Guido van Rossum at CWI in the Netherlands as a successor to the ABC programming language capable of exception handling and interfacing with the Amoeba operating system. van Rossum is Python's principal author, and his continuing central role in deciding the direction of Python is reflected in the title given him by the Python community, Benevolent Dictator for Life (BDFL).

In 1991, van Rossum published the code (labeled version 0.9.0) to alt.sources. Already present at this stage in development were classes with inheritance, exception handling, functions, and the core datatypes of list, dict, str and so on. Also in this initial release was a module system borrowed from Modula-3; van Rossum describes the module as "one of Python's major programming units". Python's exception model also resembles Modula-3's, with the addition of an else clause. In 1994, comp.lang.python, the primary discussion forum for Python, was formed, marking a milestone in the growth of Python's userbase.

Python reached version 1.0 in January 1994. The major new features included in this release were the functional programming tools lambda, map, filter and reduce. van Rossum stated that "Python acquired lambda, reduce(), filter() and map(), courtesy of (I believe) a Lisp hacker who missed them and submitted working patches." These patches were contributed by Amrit Prem.

The last version released while van Rossum was at CWI was Python 1.2. In 1995, van Rossum continued his work on Python at the Corporation for National Research Initiatives (CNRI) in Reston, Virginia from which he released several versions.

By version 1.4, Python had acquired several new features. Notable among these are the Modula-3 inspired keyword arguments (which are also similar to Common Lisp's keyword arguments), and built-in support for complex numbers. Also included is a basic form of data hiding by name mangling, though this is easily bypassed.

During van Rossum's stay at CNRI, he launched the Computer Programming for Everybody (CP4E) initiative, intending to make programming more accessible to more people, with a basic 'literacy' in programming languages, similar to the basic English literacy and mathematics skills required by most employers. Python served a central role in this: because of its focus on clean syntax, it was already suitable, and CP4E's goals bore similarities to its predecessor, ABC. The project was funded by DARPA. As of 2007, the CP4E project is inactive, and while Python attempts to be easily learnable and not too arcane in its syntax and semantics, reaching out to non-programmers is not an active concern.

In 2000, the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. CNRI requested that a version 1.6 be released, summarizing Python's development up to the point where the development team left CNRI. Consequently, the release schedules for 1.6 and 2.0 had a significant amount of overlap. Python 2.0 was the first and only release from BeOpen.com. After Python 2.0 was released by BeOpen.com, Guido van Rossum and the other PythonLabs developers joined Digital Creations.

The Python 1.6 release included a new CNRI license that was substantially longer than the CWI license that had been used for earlier releases. The new license included a clause stating that the license was governed by the laws of the State of Virginia. The Free Software Foundation argued that the choice-of-law clause was incompatible with the GNU GPL. BeOpen, CNRI, and the FSF negotiated a change to Python's free software license that would make it GPL-compatible. Python 1.6.1 is essentially the same as Python 1.6, with a few minor bug fixes, and with the new GPL-compatible license.

Python 2.0 borrowed a major feature from the functional programming languages SETL and Haskell: list comprehensions. Python's syntax for this construct is very similar to Haskell's, apart from Haskell's preference for punctuation characters and Python's preference for alphabetic keywords. Python 2.0 also introduced a garbage collection system capable of collecting reference cycles.

Python 2.1 was close to Python 1.6.1, as well as Python 2.0. Its license was renamed Python Software Foundation License. All code, documentation and specifications added, from the time of Python 2.1's alpha release on, is owned by the Python Software Foundation (PSF), a non-profit organization formed in 2001, modeled after the Apache Software Foundation. The release included a change to the language specification to support nested scopes, like other statically scoped languages. (The feature was turned off by default, and not required, until Python 2.2.)

A major innovation in Python 2.2 was the unification of Python's types (types written in C), and classes (types written in Python) into one hierarchy. This single unification made Python's object model purely and consistently object oriented. Also added were generators which were inspired by Icon.

Python's standard library additions and syntactical choices were strongly influenced by Java in some cases: the logging package, introduced in version 2.3, the SAX parser, introduced in 2.0, and the decorator syntax that uses @, added in version 2.4.

Usage

Some of the largest projects that use Python are the Zope application server, the Mnet distributed file store, YouTube, and the original BitTorrent client. Large organizations that make use of Python include Google, Yahoo! and NASA. Air Canada's reservation management system also uses Python for some of its components.

Python has also seen extensive use in the information security industry. Notably, in several of the tools offered by Immunity Security, in several of the tools offered by Core Security, in the Web application security scanner Wapiti, and in the fuzzer TAOF. Python is commonly used in exploit development.

Python has been successfully embedded in a number of software products as a scripting language. It is commonly used in 3D animation packages, as in Maya, Softimage XSI, TrueSpace, Poser, Modo, Nuke and Blender. It is also used in GIMP, Inkscape, Scribus and Paint Shop Pro. ESRI is now promoting Python as the best choice for writing scripts in ArcGIS. It is also used in Civilization IV as the control language for modding and event interaction. Eve Online, a MMORPG, is also built using Python.

For many operating systems, Python is a standard component; it ships with most Linux distributions, with NetBSD, and OpenBSD, and with Mac OS X. Slackware, Red Hat Linux and Fedora use the pythonic Anaconda. Gentoo Linux uses Python in its package management system, Portage, and the standard tool to access it, emerge. Pardus uses it for administration and during system boot.

Syntax and semantics

Python was intended to be a highly readable language. It aims toward an uncluttered visual layout, frequently using English keywords where other languages use punctuation. Python requires less boilerplate than traditional statically-typed structured languages such as C or Pascal, and has a smaller number of syntactic exceptions and special cases than either of these. Python uses indentation/whitespace, rather than curly braces or keywords, to delimit statement blocks. An increase in indentation comes after certain statements; a decrease in indentation signifies the end of the current block.

Implementations

The mainstream Python implementation, also known as CPython, is written in C meeting the C89 standard, and is distributed with a large standard library written in a mixture of C and Python. CPython ships in versions for many platforms, including Microsoft Windows and most modern Unix-like systems. CPython was intended from almost its very conception to be cross-platform; its use and development on esoteric platforms such as Amoeba, alongside more conventional ones like Unix, or Macintosh has greatly helped in this regard.

Stackless Python is a significant fork of CPython that implements microthreads; it does not use the C memory stack and will be better suited for use on microcontrollers or other limited resource platforms. It can be expected to run on approximately the same platforms that CPython runs on.

There are two other major implementations: Jython for the Java platform, and IronPython for the .NET platform. PyPy is an experimental self-hosting implementation of Python, written in Python, that can output several types of bytecode, object code and intermediate languages.

Several programs exist to package the Python interpreter with application programs (or scripts) as standalone UNIX, Linux, Windows or Mac OS X executables, including Freeze, a pure Python utility that ships with Python, or py2exe, PyInstaller, cx_Freeze and py2app, all of which are available separately.

Many Python programs can run on different Python implementations, on disparate operating systems and execution environments, without change. In the case of the implementations running on top of the Java virtual machine or the Common Language Runtime, the platform-independence of these systems is harnessed by their respective Python implementation.

Many third-party libraries for Python (and even some first-party ones) are only available on Windows, Linux, BSD, and Mac OS X.

In 2005, Nokia released a Python interpreter for the Series 60 mobile phones called PyS60. It includes many of the modules from the CPython implementations, but also some additional modules for integration with the Symbian operating system. This project has been kept up to date to run on all variants of the S60 platform and there are several third party modules available such as Miso and uitricks.



Article source: http://en.wikipedia.org/wiki/Python_%28programming_language%29



Go back to Articles home page

Go back to Programming and Web Development Articles home page



Earnings Tracker is John Dixon Technology's FREE open source accounting / bookkeeping software tool.

The software is written in PHP and MySQL and is available to use for FREE online, or as a FREE download.

Earnings Tracker, which is aimed at UK contractors, freelancers, and other very small businesses, lets you keep track of your company's revenue and spending, calculate corporation tax due, dividends that can be taken, and much more.

Earnings Tracker can also be used simply as a dividend, corporation tax, or VAT calculator.

free accounting software
 




JDT

© 2007-2009 - John Dixon Technology Ltd

Privacy Statement

Terms & Conditions