[Python-Dev] PEP 389: argparse - new command line parsing module

Robert Kern robert.kern at gmail.com
Mon Sep 28 18:39:43 CEST 2009


On 2009-09-28 10:37 AM, Steven Bethard wrote:
> On Mon, Sep 28, 2009 at 8:26 AM, Michael Foord
> <fuzzyman at voidspace.org.uk>  wrote:
>> m h wrote:
>>>
>>> Perhaps this is OT, but since command line parsing is part of
>>> configuration, I figure I'd throw it out there.  My scripts often have
>>> configuration that the command line can override and I loosely follow
>>> the example hierarchy[0] listed in The Art of Unix Programming.
>>>
>>> Some configuration I want in a config file (but I want to override
>>> from the command line) and sometimes it's very nice to use environment
>>> variables for configuration.  So I do something like this:
>>
>> Integration with command line options is an occasionally-requested feature
>> for ConfigObj. I've always said I would be open to patches...
>>
>> In other words, yes I think there is demand for it. Whether it belongs
>> *immediately* in the standard library is another matter, but if you wrote a
>> layer that unified ConfigParser and argparse I think you will find that
>> people use it.
>>
>> It is well outside the realm of this PEP however.
>
> What Michael said. ;-) If you'd like to provide a patch for argparse
> that provides such functionality, I'd be happy to review it.

cfgparse appears to fill this role for optparse. It might be straightforward to 
port it to argparse.

http://cfgparse.sourceforge.net/

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco



More information about the Python-Dev mailing list