This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lukasz.langa
Recipients BreamoreBoy, eric.araujo, fdrake, jkaufman, lukasz.langa, michael.foord, ysj.ray
Date 2010-11-04.23:54:06
SpamBayes Score 5.7881644e-11
Marked as misclassified No
Message-id <1288914857.66.0.112204692113.issue5412@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-11-04 23:54:17lukasz.langasetrecipients: + lukasz.langa, fdrake, eric.araujo, michael.foord, jkaufman, ysj.ray, BreamoreBoy
2010-11-04 23:54:17lukasz.langasetmessageid: <1288914857.66.0.112204692113.issue5412@psf.upfronthosting.co.za>
2010-11-04 23:54:16lukasz.langalinkissue5412 messages
2010-11-04 23:54:15lukasz.langacreate