On Mar 10, 2005, at 11:46 PM, Glyph Lefkowitz wrote: > 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. I'm definitely +1 on such a library. I've cobbled together something like it myself: http://svn.red-bean.com/bob/py2app/trunk/src/altgraph/compat.py And this monkey-patches readline support in for UTF-16 streams: http://svn.red-bean.com/bob/unicode/trunk/utf16reader.py -bob
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4