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

Jonathan Fine J.Fine at
Tue Nov 17 17:59:44 CET 2009


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.

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
which says
     class configparser.RawConfigParser(defaults=None,

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.


More information about the Python-list mailing list