ConfigParser shootout, preliminary entry

Michael Foord fuzzyman at gmail.com
Mon Oct 18 23:49:00 CEST 2004


mcherm at mcherm.com (Michael Chermside) wrote in message news:<1c339f13.0410181021.4041daa2 at posting.google.com>...
[snip..]

> 
> Anyway... I certainly think that the matter is less than clear-cut, but
> in my opinion, this is one of those areas where it's worth having a
> little well-bounded "magic" to make the code that much more readable.
> 
> -- Michael Chermside

Of course the good thing about python is that doing both is easy.
Using __setattr__ and sublassing dict will provide both methods with
minimal fuss.

I subclass caselessDict to get a case insensitive dictionary access -
but have been thinking about adding attributes - with a little magic
to avoid overriding any existing methods/attributes. (Just do a
dir(config) on an empty config object and that is the list of reserved
names...)

Regards,

Fuzzy

http://www.voidspace.org.uk/atlantibots/pythonutils.html



More information about the Python-list mailing list