FYI: ConfigParser, ordered options, PEP 372 and OrderedDict + bigthank you

Discussion in 'Python' started by Jonathan Fine, Nov 17, 2009.

  1. Hi

    A big thanks to Armin Ronacher and Raymond Hettinger for
    PEP 372: Adding an ordered dictionary to collections

    I'm using ConfigParser and I just assumed that the options in a section
    were returned in the order they were given. In fact, I relied on this fact.
    http://docs.python.org/library/configparser.html

    And then when I came to test the code it went wrong. After some anguish
    I looked at ConfigParser and saw I could pass it a dict_type. So I
    could fix the problem myself by writing an OrderDict. Which I duly
    prototyped (in about an hour).

    I then thought - maybe someone has been down this path before. A Google
    search quickly led me to PEP 372 and hence to
    http://docs.python.org/dev/py3k/library/configparser.html
    which says
    class configparser.RawConfigParser(defaults=None,
    dict_type=collections.OrderedDict)

    So all that I want has been done already, and will be waiting for me
    when I move to Python3.

    So a big thank you is in order.

    --
    Jonathan
     
    Jonathan Fine, Nov 17, 2009
    #1
    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. =?Utf-8?B?UGF1bA==?=

    page 372 dev web applications book

    =?Utf-8?B?UGF1bA==?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    331
    =?Utf-8?B?UGF1bA==?=
    Feb 10, 2004
  2. Robin Munn
    Replies:
    1
    Views:
    350
    Istvan Albert
    Oct 12, 2004
  3. Armin Ronacher
    Replies:
    28
    Views:
    752
  4. Replies:
    3
    Views:
    442
  5. DL

    Ordered list inside ordered list

    DL, Nov 9, 2009, in forum: Javascript
    Replies:
    6
    Views:
    335
    Dr J R Stockton
    Nov 21, 2009
Loading...

Share This Page