My Python versions
A commentator on my previous entry about the options problem asked what I thought about the argparse module. One of the answers to that is that I don't have any opinions on it because so far it has been pointless to look at it since it only exists on Python 2.7+. Some readers may be tempted to roll their eyes at me now; after all, Python 2.7 was released in 2010 and is now just over two years old. Surely it is everywhere by now, right?
The short answer is 'not so much', so let me tell you about my Python versions. Right now, I work with Python on all three currently supported Ubuntu LTS versions, on Fedora Linux, on Red Hat Enterprise 5, on Solaris 10, and on some machines running some not exactly current but very stable versions of FreeBSD. Debian Linux is also worth considering. I would like to write Python programs that have some decent chance of running on all of these and some of my programs absolutely have to.
The best environment is Fedora; both currently supported versions of Fedora have Python 2.7.3. If I only cared about this I could use all of the modern Python 2 features that I wanted to, but unfortunately Fedora is generally the least of my concern.
Currently the supported Ubuntu LTS versions are 8.04, 10.04, and the recently released 12.04; these have Python 2.5.2, Python 2.6.5, and Python 2.7.3 respectively. Our own migration to 12.04 has only started very recently and many of the current 10.04 machines are likely to stay that way until the next LTS release comes out and forces the issue. So I already can't use 2.7+ features in our main environment and I can barely use 2.6+ ones.
Solaris and Red Hat Enterprise 5 are pretty hopeless on this front; Solaris 10 has Python 2.4.6 and RHEL 5 has 2.4.3. RHEL 5 is actually pretty important for one of my programs since it's what we use on our iSCSI backends. It looks like there's a version of Python 2.6 in EPEL for RHEL 5 and in OpenCSW for Solaris, but I don't see a version of 2.7 for either. Besides, using an unofficial Python just for something like argparse is a very hard sell.
(On the good side I'm unlikely to write any substantial Python code for RHEL 5 or especially for Solaris 10.)
The FreeBSD machine that currently hosts this blog is running FreeBSD 6.4 with Python 2.5.4; DWiki had clearly better keep running on such an old Python version. (Another FreeBSD machine is running FreeBSD 8.2 with Python 2.6.2.)
The Debian stable 'python' packages is Python 2.6.6. There doesn't seem to be a version of Python 2.7 packaged for stable; you have to go up to Debian testing for that. I'm actually a little bit surprised that there is no 'python2.7' package for Debian stable; stable already has Python 2.5 as well (so it has the infrastructure to deal with multiple Python versions) and it was first released about six months after Python 2.7.
The overall thing to take away from this is that old versions of Python live on for quite a while out here in the general world. Most machines are not on current operating systems and current operating systems only barely got Python 2.7, if they have at all. Really you're doing well to have Python 2.6+ available and you don't always.