[issue1090076] Defaults in ConfigParser.get overrides section values

Raghuram Devarakonda report at bugs.python.org
Fri Feb 1 18:53:35 CET 2008


Raghuram Devarakonda added the comment:

The following two statements from ConfigParser document clearly mention
that what is passed in 'vars' are defaults and defaults come into
picture only when values are not explicitly set.

"Default values can be specified by passing them into the ConfigParser
constructor as a dictionary. Additional defaults may be passed into the
get() method which will override all others."

"ConfigParser.get(section, option[, raw[, vars]])¶
    Get an option value for the named section. All the '%'
interpolations are expanded in the return values, based on the defaults
passed into the constructor, as well as the options vars provided,
unless the raw argument is true."

If we can not change the behaviour (as it will break existing code), we
should explicitly document this fact. Basically, get() looks for options
in the following order:

1) in 'vars'.
2) in the actual section
3) in default section

----------
nosy: +draghuram

_____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1090076>
_____________________________________


More information about the Python-bugs-list mailing list