Intermezzo: A little History

 The Evolution of Python

In December 1989, Guido Van Rossum started work on a language that he christened Python. Guido Van Rossum had been part of the team that worked on the ABC programming language as part of the Amoeba operating systems in the 1980s at CWI (Centrum Wiskunde & Informatica) in Amsterdam and although he liked the ABC programming language, he was frustrated by a number of features or lack of thereof. Guido wanted a high level programming language that would speed up the development of utilities for the the Amoeba project and ABC was not the answer. The ABC programming language would however play a very influential role in the development of python as Guido took parts he liked from the language and provided solutions for aspects of the ABC programming language that he found frustrating.

Guido published the first version of the Python programing language in February 1991. This release was object oriented, had a module system, included exception handling, functions, and the core data types of list, dict, str and others. Python version 1.0 was released in January 1994 and with this release included functional programming constructs such as lambda, map, filter and reduce.

Python 1.2 was the last version released while Guido was still at CWI. In 1995, Van Rossum continued his work on Python at the Corporation for National Research Initiatives (CNRI) in Reston, Virginia where he released several versions of the language with indirect funding support from DARPRA.

By version 1.4, Python had acquired several new features including the Modula-3 inspired keyword arguments and built-in support for complex numbers. It also included a basic form of data hiding by name mangling. Python 1.5 was released on December 31, 1997 while python 1.6 followed on September 5, 2000.

Python 2.0 was released on October 16, 2000. Python 2.0 introduced list comprehensions, a feature borrowed from the functional programming languages SETL and Haskell. Python 2.0 also introduced a garbage collection system capable of collecting reference cycles.

Python 2.2 saw the first major update to the Python type system. This update saw the unification of Python’s in-built types and user defined classes written in Python into one hierarchy. This single unification made Python’s object model purely and consistently object oriented. This update to the class system of Python added a number of features that improved the programming experience. These included:

  1. The ability to subclass in built types such as dicts and lists.
  2. The addition of static and class methods
  3. The addition of properties defined by get and set methods.
  4. An update to metaclasses, __new__() and super() methods, and MRO algorithms.

The next major milestone was the release of Python 3. Python 3 was released on December 2, 2008; this was designed to rectify certain fundamental design flaws in the language that could not be implemented while maintaining full backwards compatibility with the 2.x series.

 Python 2 vs Python 3

Perhaps the most visible and disruptive change to the Python ecosystem has been the introduction of Python 3. The major changes introduced into Python 3 include the following:

  1. Print is now a function
  2. Some well known python APIs such as range, dict.keys(), dict.values return views and iterators rather than lists improving efficiency when such APIs are used.
  3. The rules for ordering comparisons have been simplified. For example, a heterogeneous list cannot be sorted, because all the elements of a list must be comparable to each other.
  4. There integer types have been whittled down to only one, i.e. int. long is also an int.
  5. The division of two integers returns a float instead of an integer. // can be used to return an integer when division takes place.
  6. All text are now unicode but encoded unicode text is represented as binary data and any attempt to mix text and data will result in an exception. This breaks backwards compatibility with python 2.x versions.
  7. Python 3 also saw the introduction of some new syntax such as function annotations, the nonlocal statement, extended iterable unpacking, set literals, dictionary comprehensions etc.
  8. Python 3 also saw update to some syntax such as that of exception handling, metaclass specification, list comprehensions etc.

The full details on changes from python 2 to python 3 can be viewed on the python website. The rest of this set of tutorials will assume that we are making use of Python 3.

 The Python Programming Langauge?

The python programming language refers to the python programming language as documented in the langauge reference.
There is no official language specification but the langugage reference provides enough details to guide anyone implementing the python programming language.
The implementation of the python programming language available at the python website is an implementation written in C and commonly referred to as cPython. This is normally used as the reference implementation. However there exists other python implementations in different languages. Popular among these are PyPy: python implemented in python and Jython: python implemented in Java.
For the rest of this set of tutorials, we use the reference CPython version that is freely distributed through the python website.


Now read this

Classes and Objects II: Descriptors

Descriptors are an esoteric but integral part of the python programming language. They are used widely in the core of the python language and a good grasp of descriptors provides a python programmer with an extra trick in his or her... Continue →