In association with heise online

02 October 2008, 11:31

Python 2.6 finalised, Python 3.0 soon?

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

The Python language's developers have released Python 2.6 final, the stepping stone Python 2.x release to allow developers to use some Python 3.0 features and be warned where they are using functionality that changes or disappears in the soon to be released Python 3.0.

The development of Python 2.6 has been happening in parallel with Python 3.0, to ensure that 2.6 is as useful as possible for the future migration of Python code to 3.0. A switch, -3 has been added to the Python command line which activates warnings from the interpreter for any code constructs that will be invalidated in 3.0. A number of 3.0 features have been backported to Python 2.6 and included by default. Other 3.0 features can be imported using Python's "from future" directives allowing Python 3.0 compatible code to be written but these features will break Python 2.x code as they change the semantics of operations such as ascii(),filter,map and others. The "from future" mechanism does allow developers to selectively migrate their code towards 3.0, rather than having to do a massive refactoring.

One language change in 2.6 is the with statement, which appeared in Python 2.5 as a "future import". In 2.6, with is enabled by default and supported by a new contextlib module. The with statement is an alternative to try...finally construct and is designed to automatically clean up resources. Python 3.0 has a new format function and this has been backported to 2.6 making richer output formatting possible.

A number of new modules have been added to Python 2.6. A json module supports the encoding and decoding of Python types in JSON (JavaScript Object Notation) and a plistlib module allows for access to .plist format files as found on Mac OS X, on any platform. A multiprocessing module has been added which allows Python programs to run mutiple concurrent processes, rather than threads, and coordinate those processes with queues, pipes, locks and semaphores, potentially allowing Python to exploit multicore CPUs more effectively.

Python 2.6 sees a change to the documentation system used; previously, the documetation was produced in LaTeX for high quality printing. Python's developers have worked on a new system, Sphinx which generates HTML, Windows HTML Help, LaTeX and printable PDF output. Sphinx supports automatic indexing and can automatically highlight Python code in the documentation which is now written with reStructuredText markup.

The Python 2.6 release is available from the Python web site and includes a full guide to what's new.


Print Version | Send by email | Permalink:

  • July's Community Calendar

The H Open

The H Security

The H Developer

The H Internet Toolkit