[issue9421] configparser.ConfigParser's getint, getboolean and getfloat don't accept `vars`
Łukasz Langa
report at bugs.python.org
Sat Sep 4 00:43:49 CEST 2010
Łukasz Langa <lukasz at langa.pl> added the comment:
On IRC Fred asked:
> Why are delimiters and comment_prefixes in the constructor signatures?
Like most configurable options, they were added to the initializer one by one (after `allow_no_value`). Only later did I notice that actually things like optionxform, _boolean_states, etc. are configurable by assignment. So this is a design decision whether one way should be preferred over the other. In a way that's unfortunate that we now have two obvious ways to do it.
I believe that keyword arguments are far better because they are more declarative, e.g.:
parser = SafeConfigParser(delimiters=(':=',),
comment_prefixes=('//',))
vs.
parser = SafeConfigParser()
parser._delimiters = (':=',)
parser._comment_prefixes = ('//',)
It's the way ORMs and many other frameworks do it and it feels natural.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9421>
_______________________________________
More information about the Python-bugs-list
mailing list