dictionary comprehensions with Python 2.4/2.5

  • Thread starter Iryna Feuerstein
  • Start date
I

Iryna Feuerstein

Hello,

for the program developed and maintained by our company the
compatibility with Python 2.5 is desired. I'm developing with Python
2.7, though I would like to use dictionary comprehensions in my 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?


Thank you in advance!

With regards,
Iryna.
 
P

Paul Rubin

Iryna Feuerstein said:
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 ... )
 
I

Iryna Feuerstein

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

Thank you very much! It is the perfect solution for me.

Regards,
Iryna.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top