|
From: Fuzzyman <fuz...@vo...> - 2006-01-30 20:24:33
|
Fuzzyman wrote:
> Aaron Bentley wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Fuzzyman wrote:
>>
>>> * To reverse the order of the arguments, with section defaulting to
>>> None. This leads to confusion in the (theoretical) ConfigParser
>>> compatibility layer, which will of course be reversed back. It is
>>> *slightly* more friendly for normal use though.
>>>
>>
>> For values in a subsection, we'd also be able to do:
>> val=cfg['subsection'].getboolean('key'), right? That's more in keeping
>> with your existing UI. Perhaps you'd prefer to use different names from
>> the ConfigParser ones. ('asbool', 'asfloat'?)
>>
>>
> I'm copying this to the configobj-develop mailing list because I value
> Nicola's input on this. Perhaps you'd consider joining the list Aaron
> (low traffic - via sourceforge).
>
> I am going to implement these as section methods. My initial idea was
> to implement them using the ConfigParser names and syntax. This means
> you would have to specify a subsection, but could specify None to get
> values in the section you are calling from.
>
> In order to avoid this there are three (reasonable) options :
>
> 1) Implement ``asbool`` *and* ``getbool`` methods - ``getbool``
> following ConfigParser signature.
> 2) Just implement ``asbool`` and leave ``getbool`` for a ConfigParser
> compatibility layer - if it ever happens.
> 3) Implement ``getbool`` but make the second argument optional (by
> having None as the default). If no second argument is specified, treat
> the first argument as a key *not* a section...
>
> I have a mild preference for 2) but quite like 3). 3) is weird because
> it changes the meaning of the first argument *if* you provide a second...
>
> Opinions please...
>
Actually I like 3. It keeps compatibility with ConfigParser (benefit of
familiarity), and achieves both aims.
If you supply one argument it's a key, if you supply two they are
``section, key``.
Oh, except it's ``getboolean`` not ``getbool``. :-)
All the best,
Fuzzyman
http://www.voidspace.org.uk/python/index.shtml
>> I don't think we'll be exposing ConfigObj directly, so I don't think
>> this is a big deal for us, either way.
>>
>>
>>> Should I then remove ``istrue`` (added in 4.1.0) which is effectively
>>> the same as ``getboolean`` ? I would deprecate it and add a warning
>>> until 4.3.0.
>>>
>>
>> I have no personal stake in istrue.
>>
>>
> Don't start using it then. :-)
>
> All the best,
>
> Fuzzyman
> http://www.voidspace.org.uk/python/index.shtml
|