[Python-Dev] ConfigParser patches

Tim Peters tim.peters at gmail.com
Sat Oct 2 00:29:49 CEST 2004

> What I have come to like, both for dealing with XML and with .ini
> files, is something that lets you map the configuration values (or
> whatever it is that you're parsing, really) to Python attributes. This
> is really some kind of simplified DTD support, and there are different
> ways to go about it; but the net result is that you end up writing
> e.g. options.client.max_retries (which is an int with a default value)
> rather than options.getint("client", "max-retries").

LOL.  I wrote a Config wrapper for SpamBayes like that.  Then I
stopped paying attention, and next thing I knew all the
option-accessing code had been changed to look like SB's current

            prob = options["Classifier", "unknown_word_prob"]

instead.  But even that's better than options.getint("client",
"max-retries")!  Encoding the return type at every access point is
Plain Wrong.

More information about the Python-Dev mailing list