dictionary comprehensions with Python 2.4/2.5

Discussion in 'Python' started by Iryna Feuerstein, Aug 7, 2012.

  1. 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.
     
    Iryna Feuerstein, Aug 7, 2012
    #1
    1. Advertising

  2. Iryna Feuerstein

    Paul Rubin Guest

    Iryna Feuerstein <> 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 ... )
     
    Paul Rubin, Aug 7, 2012
    #2
    1. Advertising


  3. >
    > 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.
     
    Iryna Feuerstein, Aug 7, 2012
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. seguso
    Replies:
    9
    Views:
    401
    seguso
    Dec 22, 2004
  2. Dave Kuhlman

    Re: Style in list comprehensions

    Dave Kuhlman, Aug 15, 2003, in forum: Python
    Replies:
    1
    Views:
    342
    Alex Martelli
    Aug 16, 2003
  3. Jeff Epler
    Replies:
    2
    Views:
    338
    Jeff Epler
    Aug 27, 2003
  4. Steven Bethard

    removing list comprehensions in Python 3.0

    Steven Bethard, Jul 8, 2005, in forum: Python
    Replies:
    30
    Views:
    839
    Steven Bethard
    Jul 13, 2005
  5. Steven Bethard
    Replies:
    7
    Views:
    411
    Rocco Moretti
    Jan 20, 2006
Loading...

Share This Page