Examining Python 2.3: New Additions
- Python 2.3
- Sets
- Bool
- Logging
- Miscellaneous Enhancements
- Conclusion
It won't be long now before the next version of the Python programming language becomes available for general use. I've been messing around with the first alpha for some time now, and I really like what's in therefrom a techie's perspective, that is.
But techies always like new toys, even if those toys aren't too useful in the dreary daily grind. Whether there will be compelling, practical reasons to upgrade to the new version of Python is one of the questions I set out to answer when I started investigating the new Python 2.3a.
Python has been a very stable language for quite a long time. Version 1.5.2 was stable and relatively bug-free, and it offered the most important constructs needed to code most algorithms. It also came with batteries included: lots and lots of stable libraries.
With Python 2.0, the core language started acquiring new features at a rate of knots. Most developers won't be using the new features all that much: Generators are extremely cool, but at the same time, are not a tool that people grope for instinctively. And there are many more new features. It will take a long time for developers to catch up.
Python now includes iterators, generators, list comprehensions, nested scopes, type unificationand complete Unicode compatibility. The older functional programming style constructs, such as map, filter, reduce, and lambda are deprecated, even if it's unlikely that they will disappear.
Python 2.3
With Python 2.3, the rate of feature accretion seems to have slowed a bit. That's a good thing, in my opinion, because one of the main advantages of Python is that it makes it possible for most developers to keep the whole language in their head, even if they are subject specialists for whom programming is a tool to help them with their work instead of a full-time job or a hobby.
That said, there's enough to get excited about: Some built-in functions have been upgraded, and a few have been added. Most of the work has been done on the batteries, though. Most interesting is the addition of a real logging library. Logging through print statements doesn't cut it. We now have sets, a bz2 compression lib, SSL added to IMAP, a far superior random generator, a text wrapper, the ability to write source in encodings other than ASCII, a new command-line option parser, and, finally, zipimport, which can be used to package your Python modules in a ZIP file and import from that. Rather like Java's JAR, it's a very welcome addition.
When Python 2.3 will be released, it will also include the improved IDLE from IDLEFORK. It's still not a patch in WingIDE (see also http://www.informit.com/content/index.asp?product_id={69D0061B-8EA5-4309-962A-3F6BD33B721C}), which is by far the most powerful Python IDE in existence.
Improvements that were are not in the Alpha that I tested but that are being discussed on the python-dev mailing list are better pickling of new-style classes, upgrading of parts of the standard installation, and a module to handle UNIX-style TAR files, in all useful compression formats.
A very serious problem is that Python's sandbox rexec and bastion modules have become complete unsafe and, thus, unusable. This means that Python can no longer be used to execute mobile code, for instance. A fix does not seem to be forthcoming. There is some hope: This situation is very seriousit affects the Python interpreter embedded in PostgreSQL, for instanceand people are working on it.
I think that the absolute highlights of Python 2.3 are the new Set datatype, the bool type and the logging package, and a number of smaller enhancements to existing classes. I'll discuss each of these features briefly.