dictionary comprehensions with Python 2.4/2.5

Paul Rubin no.email at nospam.invalid
Tue Aug 7 02:58:02 EDT 2012


Iryna Feuerstein <Iryna.Feuerstein at FernUni-Hagen.de> writes:
> code. The dictionary comprehensions were added to Python in version
> 2.7 at first time. Is it possible to make it compatible with Python
> 2.5 anyway? Perhaps by using the __future__ module?

Not back to 2.5, but they're not that important anyway.  Just use:
   d = dict((k, v) for k,v in ... )



More information about the Python-list mailing list