Éric Araujo mer...@netwok.org added the comment:
I’d find more natural to have cp['spam'] return the section (as a dict) and
cp['spam']['ham'] return the value.
--
nosy: +merwok
___
Python tracker rep...@bugs.python.org
Łukasz Langa luk...@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
Ray.Allen ysj@gmail.com added the comment:
lukasz,
- 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'm afraid
Michael Foord mich...@voidspace.org.uk added the comment:
As in ConfigParser you are always accessing a section and value I'm happy with
tuple indexing.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5412
Michael Foord mich...@voidspace.org.uk added the comment:
There are no docs or tests in the patch. I like the functionality though and
doubt it will be controversial. The current api is a bit arcane. So +1 from
me.
--
nosy: +michael.foord
___
Łukasz Langa luk...@langa.pl added the comment:
I'd say we go for it. At the moment most (if not all) drop-in replacements
for ConfigParser support this functionality. It's backwards compatible and
useful. One might argue than it's more pythonic than getfloat() co.
I'd also add
Mark Lawrence breamore...@yahoo.co.uk added the comment:
Patch is simple, are people for or against syntactic sugar in configparser?
--
nosy: +BreamoreBoy
stage: - unit test needed
versions: +Python 3.2 -Python 3.1
___
Python tracker
New submission from Jeff Kaufman jkauf...@bbn.com:
This is a patch against the configparser in the cvs version of 3.1 to
support [] notation:
import configparser_patched
config = configparser_patched.SafeConfigParser()
config.add_section(spam)
config[spam, eggs] = yummy
config[spam, eggs]