New submission from Łukasz Langa <luk...@langa.pl>:

ConfigParser (and in effect SafeConfigParser) accept `vars` in the `get()` 
method so one can override values from the section, merge data from different 
sources or simply state some required keys for interpolation.

`getint()`, `getfloat()` and `getboolean()` don't accept this argument and this 
is the reason for this issue: for all getters to present a consistent interface.

There is a small design question here however. We have an inheritance model in 
configparser that goes like this:

  RawConfigParser -> ConfigParser -> SafeConfigParser

ConfigParser redefines `get()` for the purposes of interpolation but doesn't 
touch the other getters. It's good because in terms of implementation, they are 
just `type()` decoration over `get()` where type is `int`, `float` or `bool`.

The obvious solution would be to add **kwargs to these getters so that 
regardless of the implementation of the actual `get()`, all possible values are 
being passed to it. We can then comment in the docstring that for possible 
values of **kwargs, the user should check the interface of `get()`. Is that 
good enough?

Other ideas?

PS. I have a patch for the proposed design, will attach if there's consensus.

----------
components: Library (Lib)
messages: 111986
nosy: georg.brandl, lukasz.langa, michael.foord, pitrou
priority: normal
severity: normal
status: open
title: configparser.ConfigParser's getint, getboolean and getfloat don't accept 
`vars`
type: behavior
versions: Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9421>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to