Noob confused by ConfigParser defaults
Peter Otten
__peter__ at web.de
Mon Feb 20 18:04:09 EST 2017
Tim Chase wrote:
> On 2017-02-20 10:45, Peter Otten wrote:
>> value = parser.get("section-1", "option-1", fallback="default
>> value")
>
> Huh. Do you remember when this was added? I see it in the 3.x docs,
> but not the 2.x docs. I remember writing my own wrappers multiple
> times for exactly these purposes, even to the point of opening an
> issue in the hopes of getting something of the like included
>
> https://lists.gt.net/python/bugs/827378?do=post_view_threaded
>
> So I'm glad to see it arrived; just curious when that happened
> officially.
I don't use configparser regularly, so I had to look around myself and found
https://docs.python.org/3.2/whatsnew/3.2.html#configparser
"""
A number of smaller features were also introduced, like support for
specifying encoding in read operations, specifying fallback values for get-
functions, or reading directly from dictionaries and strings.
(All changes contributed by Łukasz Langa.)
"""
Łukasz also closed your bug report
http://bugs.python.org/issue8666#msg113414
but the superseding issue is itself superseded...
More information about the Python-list
mailing list