Is there an officially updated recommendation indicating which versions of Python should be supported by released modules? Or perhaps a page giving a survey of production usage of various versions? It's difficult to know how much use to make of newish features like context managers, class decorators, etc. when writing a module.
Note that learning which versions of Python are in common usage now is only part of my question; I'd like to find a resource which will provide up-to-date information for future readers of this thread (and myself开发者_如何学Go).
I'm not aware of any single resource keeping an up-to-date summary of production usage of different Python versions, but a good start would probably be to check which Python versions that are distributed with various Linux distributions. Here's a sample for some of the most used server distributions (taken from Distrowatch):
Debian
- Debian 5.0 (2009-02-15): Python 2.5.2
- Debian 4.0 (2007-04-08): Python 2.4.4
- Debian 3.1 (2005-06-06): Python 2.3.5
Ubuntu
- Ubuntu 10.04 LTS (2010-04-29): Python 2.6.5
- Ubuntu 8.04 LTS (2008-04-24): Python 2.5.2
Red Hat Enterprise Linux
- RHEL 5.5 (2010-03-30): Python 2.4.3
- RHEL 4.8 (2009-05-19): Python 2.3.4
- RHEL 3.9 (2007-05-30): Python 2.2.3
Clearly, Red Hat is the limiting factor here. The latest stable RHEL release ships with Python 2.4, and as there's a fair number of RHEL servers out there, you'll have to target Python 2.4 unless you want Red Hat users to install a newer Python version from source or from third-party RPMs. If you don't mind leaving RHEL behind you could probably go for 2.5 or 2.6 instead.
Mac OS X 10.6 (Snow Leopard) has 2.6.1 as the installed version.
IIRC, 10.5 (Leopard) has 2.5 as the installed version.
精彩评论