Your Linux Data Center Experts

Here I was feeling all mighty for having my laptop running the latest Python release as “/usr/bin/python”. It was a nice two weeks. Now, Python 2.4 final has been released and has some really good stuff in it. I've uploaded some RPMs for FC3, and the tar as well as the source RPM can easily be built for most older systems.

Andrew Kuchling has a nice write up on what's new in Python 2.4. A quick read covering some of the most important changes in 2.4.

Of course, my favorite change in 2.4 is the inclusion of “rstrip()” for strings, but I'm biased. That's a change that I contributed. It took an incredibly long time to get accepted into the core though. Initially it was rejected because it was trivial to re-implement. Of course, the example re-implementation given in the patch response to demonstrate this had a subtle bug. I finally gave up on it, but several users over the next year continued asking for it to be re-considered so it was finally accepted.

There are two other changes which I'll probably use the most. One is the new subprocess module which gets rid of the popen2/popen3/popen4 functions and has other conveniences for calling external processes. The popen* functions I always have to look at the documentation to remember what they do beyond popen2().

I also predict that I'll find the simpler string substitutions via the new Template class of the string module. It was kind of strange to read the description for it, though, because they mention Mailman and then a few paragraphs later they show a sample of using the companion class “SafeTemplate”. I'm pretty sure this is a direct descendant from the Mailman patch I made years ago which implemented a “SafeDict” class for use in the Mailman templates so that an improperly formed template would no longer cause tracebacks. It was kind of surreal to run across that realizing that I probably had an influence on it.

Oh, except I just realized that the What's New document has an error there. There is no SafeTemplate in the final release. It's simply a different function of the Template class named “safe_substitute()”. I'd better report that to the doc folks.

comments powered by Disqus

Join our other satisfied clients. Contact us today.