[Python-Dev] rationale for the no-new-features approach

Glyph Lefkowitz glyph at divmod.com
Fri Mar 11 05:46:02 CET 2005


Bob Ippolito wrote:
> try:
>     set
> except NameError:
>     from sets import Set as set

Syntactical variations notwithstanding, I think it's a common desire to 
want to run on at least the last few versions of Python, but take 
advantage of improvements and not emit deprecation warnings on the 
latest and greatest.

I am considering releasing a forward-compatibility library for 
installation alongside applications that need to use multiple versions 
of Twisted, so they can do it in a style which is closer to the new 
versions than the old ones: perhaps it might be good practice to start 
doing this for Python as well?

That way instead of multi-line "except NameError" tests all over the 
place you can simply have one-liner boilerplate for every module in your 
project:

	'from py24compat import *'

Easy to grep/sed for when you're ready to stop supporting old versions, 
too, for those of you without a copy of the refactoring editor from the 
2009 release of PyDev/Eclipse.

The only problem with this idea is that the 2.3 -> 2.4 transition has 
been extremely smooth for me - there are no new features I desperately 
want to use, and there are no old features that were deprecated or 
altered (that I've found yet - knock on wood).  Still, future 
incompatibilties are inevitable.

Of course I'd also like to echo the thanks to Anthony for having 
relegated this problem to major releases.


More information about the Python-Dev mailing list