making python 2.3 not complain about generator expressions?
Andrew Koenig
ark at acm.org
Mon Jul 12 23:40:07 EDT 2004
"Dan Christensen" <jdc at uwo.ca> wrote in message
news:87iscs4m06.fsf at uwo.ca...
> I'd like to be able to do something like:
>
> if pythonversion >= 2.4:
> g = (x for x in [1,2,3])
> else:
> g = iter([1,2,3])
>
> But even though the first branch doesn't execute in python 2.3, the
> parser still complains.
How about
if pythonversion >= 2.4:
import newcode as code
else:
import oldcode as code
More information about the Python-list
mailing list