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

Steven Bethard steven.bethard at gmail.com
Mon Sep 28 16:43:04 CEST 2009

On Mon, Sep 28, 2009 at 4:09 AM, Neal Becker <ndbecker2 at gmail.com> wrote:
> If the plan is to migrate from optparse to argparse, this could be made a
> bit easier.  If it weren't for the fact that some names are different in
> argparse than optparse, I believe many optparse usages could port with no
> change.

I could conceivably add an OptionParser class which::

* Has an add_option method which delegates to add_argument

* Has a parse_args method which delegates to parse_known_args

* Registers the string names for types that optparse uses

That might allow some users to just switch their import as long as
they're not using any callbacks, catching any exceptions, extending
any APIs, etc. I'm not 100% convinced that it's good to add a subtly
different API that people would have to unlearn, but if there's enough
support for this, I'm open to the idea.

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

More information about the Python-Dev mailing list