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

Steven Bethard steven.bethard at gmail.com
Wed Sep 30 01:38:53 CEST 2009

On Tue, Sep 29, 2009 at 3:04 PM, Glenn Linderman <v+python at g.nevcal.com> wrote:
> On approximately 9/29/2009 1:57 PM, came the following characters from the
> keyboard of Steven Bethard:
>> If you're not using argparse to write command line applications, then
>> I don't feel bad if you have to do a tiny bit of extra work to take
>> care of that use case. In this particular situation, all you have to
>> do is subclass ArgumentParser and override exit() to do whatever you
>> think it should do.
>> There is only a single method in argparse that prints things,
>> _print_message(). So if you want it to do something else, you can
>> simply override it in a subclass. I can make that method public if
>> this is a common use case.
> Documenting both of these options would forestall people from thinking it is
> only useful for console applications.

I'm totally fine with people thinking it is only useful for console
applications. That's what it's intended for. That said, if there are
people out there who want to use it for other applications, I'm happy
to make things easier for them if I know concretely what they want.

> An example of using argparse with Tk
> (I think that is the only GUI that ships with Python) would also be good.

I don't really use GUI libraries, so I wouldn't be able to come up
with such an example. I'd also rather not make API changes based on
speculative use cases, so before I spend time documenting these
things, I'd really like to hear from someone who has already, say,
used getopt or optparse in conjunction with a GUI library, and what
feedback they have about that.

Where did you get that preposterous hypothesis?
Did Steve tell you that?
        --- The Hiphopopotamus

More information about the Python-Dev mailing list