The Python development community announced Thursday the official release of version 2.6, a significant transitional release that introduces some of the features that have been implemented for Python 3.0. It includes support for new syntactic features, new modules, and some structural improvements.
Python 3.0 will be the first major release to break backwards compatibility with prior versions. It will move the language forward with significant improvements to I/O handling, string formatting, the class system, and many other aspects of the language. The compatibility break, however, will create serious challenges for application developers and much existing code will have to be ported to work properly.
The Python community has worked very hard to minimize the disruptive impact of the transition and make it more seamless and natural. The 2.6 release is a very important part of that strategy because it provides a crucial stepping stone for the migration of existing code. Python 2.6 provides backwards compatibility with the 2.0 series but also includes many features that have been backported from Python 3.0. Additional 3.0 features can be toggled individually by importing from future_builtins and using various flags at the command line. Python 2.6 also emits warnings when it detects the use of deprecated functionality that will not be supported in 3.0. This approach will make it possible for third-party developers to shift applications and libraries over to 3.0 incrementally and with minimal breakage.
Python 2.6 introduces the new format method for string types. The format method, which is based on PEP 3101, can be used as an alternative to the string "%" operator and facilitates more sophisticated interpolation capabilities. The behavior of the format method can be overloaded in individual classes by defining __format__.
This release also adds several additional modules to Python's standard library. The new io module, which is specified in PEP 3116, provides a new structured I/O system that will provide a stronger foundation for Python's concept of file-like objects. Another very welcome addition is the new JSON library (based on simplejson), which can translate Python values to and from JSON. This presently only works on built-in types, but it can be expanded with custom encoders. Python 2.6 also adds plistlib, a new module for reading and writing Mac OS X property lists.
The class system has a few new tricks to offer in this release too, including some object model refinements and esoteric features for metaprogramming. The most significant additions in this area are class decorators and abstract base classes. There are also new getter and setter decorators for properties and a new abstract syntax tree module that can parse Python expressions and generate a nested tree structure with representations of Python operations.
Some Python 3.0 features that break backwards compatibility are available as options in 2.6. For instance, developers can import the new print function from __future__ to replace the standard print keyword. The future_builtins module contains several more, including the new iterator-based map and filter functions.
Python 2.6 doesn't offer many surprises for those of us who have been closely watching the development process. This release solidly delivers on the promise of a smooth transition to 3.0 and provides access to a lot of compelling new functionality. Development on Python 3.0 is moving along quickly and the first release candidate was issued last month. To download Python 2.6, visit the official web site. For more information, check out the official overview of changes in the release.
No comments:
Post a Comment