python file versioning

Timothy Fitz firemoth at gmail.com
Tue Oct 26 09:20:37 CEST 2004


> file mod_22:
> from __future__ import nifty_feature
> import bar
>
> file mod_23:
> import bar
>
> app.py:
>
> import sys
>
> if sys.version_info[:2] == (2,2):
>     import mod_22 as mod
> else:
>     import mod_23 as mod

No need for all of that, from __future__ import feauture becomes a
no-op if you use it on a version that already has the feature (for
instance, from __future__ import generators)



More information about the Python-list mailing list