In what has been called by some commentators the ‘most significant update in five years’ the latest version of Python finally come of age. Python 2.5 not only apparently fixes some 450 bugs discovered since the 2.4 release was, err, released, but also throws in some 350 patches for good measure. Hey Microsoft, there’s a new patch king in town and it’s the Python Software Foundation.
Although officially ‘suitable’ for production use, the changes that help improve the way Python supports 64 bit systems might break certain C extension modules, so you might want to take that particular definition of suitable with a pinch of salt.
That said, the use of Buildbot to continuously test across platforms does enable the Python development team to uncover potential problems during development in a more timely fashion that ever before, hence all those big fixes and patches. As well as being more reliable, because of the Buildbot effect, Python 2.5 is also claiming to be faster. Much faster, with major speedups in exception handling and string operations, as well as a number of other changes to improve performance.
But I guess that the new language features will be of most interest to those of you reading this: features such as the fact that the compiler now converts the source code to an abstract syntax tree (AST) before producing the bytecode; the 'with' operator replaces a common try/finally idiom that results in much cleaner and safer code; generators have gained push, throw and close methods so that values passed to push will be returned by the yield statement when the generator is resumed, throw takes an exception and causes the yield statement to raise the passed exception in the generator, while close is used to terminate a generator. This turns generators into a form of co-routine and makes them even more powerful. So the Python guys tell me. They also tell me that internally Python was changed to use the Py_ssize_t type, enabling many structures that were limited to 2^32 objects to now hold up to 2^64 instead.
Want the complete list of what’s new? Then head over to the What’s New in Python 2.5 page and check it out yourself.