`~/.pythonrc' `from __future__ import'

François Pinard pinard at iro.umontreal.ca
Mon Jul 8 11:36:42 EDT 2002


[Michael Hudson]

> try:
>    from two_point_two_using_module import func
> except SyntaxError: # is that what bogus future statements should 
>                     # really raise?  too late now, I guess
>    from two_point_one_using_module import func

> Writing code that uses 2.2 features where possible but still runs on
> 2.1 is a pain, but I'm not sure how it could have been done better, really.

I agree with you, thanks for the hints.  Your approach is workable, at
least for packages big enough to warrant many modules.  It might also
mean that for really simple packages, such portability is not affordable,
so better plainly write for the oldest Python one wants to support.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list