[stdlib-sig] ConfigParser - parsing options with no value

Michael Foord michael at voidspace.org.uk
Fri Sep 18 02:30:04 CEST 2009


Yeah - I just never miss an opportunity to promote ConfigObj. :-)

The nice thing about it is that the basic API is *so* much nicer than  
ConfigParser. Parts of that would be easy to get on and other parts  
would require major surgery and result on a hybrid there's-now-two- 
ways-to-do-it API. ConfigObj is bizarrely widely used so I'm happy  
with it as a third party module. Fact of the day though, the first  
version (about five years ago now) was only written because I didn't  
know ConfigParser existed...

Michael


--
http://www.ironpythoninaction.com

On 18 Sep 2009, at 01:20, Jesse Noller <jnoller at gmail.com> wrote:

> I was being ever slightly tongue in cheek, but I for one would like  
> to see bits of configobj get into configparser, having used the  
> latter several times until I discovered the magical world of json/YAML
>
> On Sep 17, 2009, at 8:09 PM, Michael Foord  
> <michael at voidspace.org.uk> wrote:
>
>>
>> Sorry to top-post, sent from phone-like-device.
>>
>> Actually Guido has shot down the inclusion of ConfigObj on the  
>> past, so it doesn't seem worth a PEP.
>>
>> He doesn't like that sections inherit from dict (although they are  
>> functionally key-value mappings) as it gives them an over-wide API.  
>> This is fair enough.
>>
>> He also fundamentally disliked the idea of nested sections, doesn't  
>> see the need and suggested people should be using XML for this kind  
>> of use case! It is an often requested feature, so this I thought  
>> was odd. Anyway, so be it.
>>
>> Michael
>>
>> --
>> http://www.ironpythoninaction.com
>>
>> On 18 Sep 2009, at 00:59, Jesse Noller <jnoller at gmail.com> wrote:
>>
>>>
>>>
>>> On Sep 17, 2009, at 7:34 PM, Michael Foord  
>>> <michael at voidspace.org.uk> wrote:
>>>
>>>> Georg Brandl wrote:
>>>>> Brett Cannon schrieb:
>>>>>
>>>>>> On Thu, Sep 17, 2009 at 09:53, Mats Kindahl <mats at sun.com> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I am currently using the ConfigParser module to parse MySQL  
>>>>>>> configuration files.
>>>>>>> Just plain config files, nothing fancy except... options  
>>>>>>> without values.
>>>>>>>
>>>>>>> There is a number of options here that does not require a  
>>>>>>> value, they are
>>>>>>> basically just turning on a feature. They are also common in  
>>>>>>> the standard
>>>>>>> template files for the server. Options that are for mysqld can  
>>>>>>> have a value even
>>>>>>> though it is not required and the option file parser will not  
>>>>>>> complain, but for
>>>>>>> some of the client tools, values may not be given or there  
>>>>>>> will be a error.
>>>>>>>
>>>>>>> Looking at the tests of ConfigParser, I see that it is a  
>>>>>>> deliberate design
>>>>>>> decision to not allow options without values (or I am  
>>>>>>> misunderstanding
>>>>>>> something). Why?
>>>>>>>
>>>>>>>
>>>>>> Who knows. =) Module is old enough it's quite possible no one
>>>>>> remembers why.
>>>>>>
>>>>>
>>>>> Good point.  There's also an awful shortage of config parsers in  
>>>>> the standard
>>>>> library; we should add one or two.
>>>>>
>>>>> Georg
>>>>>
>>>>>
>>>> I happen to know a good one we could add. ;-)
>>>>
>>>> Michael
>>>>
>>>
>>> +1 I eagerly await a PEP


More information about the stdlib-sig mailing list