Testing for version to use from __future__ in 2.1
Daniel Klein
danielk at aracnet.com
Sat May 12 11:15:41 EDT 2001
I've been testing my software using Python version 2.1 with the 'from __future__' statement and I'd
like to be able to release it to users of both 2.1 and 2.0. So I thought to put something like this
as the first line in the module:
if sys.version[:3] == '2.1': from __future__ import nested_scopes
but this returns a (not entirely unexpected) SyntaxError. :-(
Is there anyway (short of maintaining 2 versions) to 'have my cake and eat it too', as this line
would be the only difference betwixt versions of my software.
Thanks,
Daniel Klein
More information about the Python-list
mailing list