Message120459
Patch updated yet again:
* optional .get() arguments are now keyword only. This is a bit
backwards incompatible but:
* protects users of mapping protocol access from invoking get() as if
the last positional argument was the `fallback` value (it would be
`raw` for (Safe)ConfigParsers and `vars` for RawConfigParsers)
* so it will improve API compatibility between Raw and others
* it will make the client code more readable, e.g.:
anyParser.get('section', 'value', fallback=True)
vs.
rawParser.get('section', 'value', {}, True)
safeParser.get('section', 'value', 0, {}, True)
parserUsedWrong('section', 'value', True) # NOT a fallback!
* mapping protocol access is now quite thoroughly documented
* renamed `default` arguments to get() to `fallback`. This is *not*
backwards incompatible because those arguments were just recently
added by me. I chose to rename them since because of DEFAULTSECT
there already is a well-defined "default value" concept. Now the
situation is much clearer, e.g. the docs can simply state: "default
values have precedence over fallback values." and this is
unambiguous.
As for some suggestions to just provide the section dictionaries
directly, this won't work because of interpolation and the terrific
DEFAULT section special case, e.g. if a config file contains a DEFAULT
section and other sections lack a value, it will be returned instead on
get(). Also, DEFAULT values are used in interpolations. On top of that,
the provided section proxies ensure while setting that the database
holds only strings (which it should by design).
There is still one paragraph to be finished (Customizing Parser
Behaviour). This has to wait for tomorrow. |
|
Date |
User |
Action |
Args |
2010-11-04 23:54:17 | lukasz.langa | set | recipients:
+ lukasz.langa, fdrake, eric.araujo, michael.foord, jkaufman, ysj.ray, BreamoreBoy |
2010-11-04 23:54:17 | lukasz.langa | set | messageid: <1288914857.66.0.112204692113.issue5412@psf.upfronthosting.co.za> |
2010-11-04 23:54:16 | lukasz.langa | link | issue5412 messages |
2010-11-04 23:54:15 | lukasz.langa | create | |
|