[issue5412] extend configparser to support [] syntax

Łukasz Langa report at bugs.python.org
Wed Jul 28 12:55:11 CEST 2010


Łukasz Langa <lukasz at langa.pl> added the comment:

Éric, first thing: forget about the current patch because it's very much incomplete.

Second thing, while I normally would agree with you about the ['section']['key'] idea, in this case the current syntax has following advantages:

- we can implement a cohesive mapping protocol that extends to get(), del, in, etc. For now get() seems somewhat similar to what dictionaries give you and I would build on that (adding a `default` attribute would be another thing).

- manipulation on the internal structures is much simpler when we have a single key like that. Having config['name'] return the section would make us create another proxy object just to support mutating keys in the section.

I can see arguments for and against this approach but overall, it looks nice.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5412>
_______________________________________


More information about the Python-bugs-list mailing list