ConfigParser preserving file ordering

Andrew Durdin adurdin at gmail.com
Fri Oct 19 09:16:00 EDT 2007


On 10/19/07, Frank Aune <Frank.Aune at broadpark.no> wrote:
>
> Yes, but as I said I need functionality present in the standard-library, so
> sub-classing ConfigParser is the last option really.

Any particular reason you're limited to the standard library?

I've used iniparse <http://code.google.com/p/iniparse/> before as a
drop-in replacement for ConfigParser that preserves ordering and
comments, and only falling back to ConfigParser if iniparse wasn't
present; like this:

try:
    from iniparse.compat import *
except ImportError:
    from ConfigParser import *

As for updating ConfigParser -- like most other changes, it probably
needs a champion.

Andrew



More information about the Python-list mailing list