[Python-Dev] Pronouncement on PEP 389: argparse?

Ian Bicking ianb at colorstudy.com
Mon Dec 14 19:22:53 CET 2009


On Mon, Dec 14, 2009 at 12:04 PM, Steven Bethard
<steven.bethard at gmail.com> wrote:
> So there wasn't really any more feedback on the last post of the
> argparse PEP other than a typo fix and another +1.

I just converted a script over to argparse.  It seems nice enough, I
was doing a two-level command, and it was quite handy for that.

One concern I had is that the naming seems at times trivially
different than optparse, just because "opt" or "option" is replaced by
"arg" or "argument".  So .add_option becomes .add_argument, and
OptionParser becomes ArgumentParser.  This seems unnecessary to me,
and it make converting the application harder than it had to be.  It
wasn't hard, but it could have been really easy.  There are a couple
other details like this that I think are worth resolving if argparse
really is supposed to replace optparse.

I'd change this language:
"The optparse module is deprecated, and has been replaced by the
argparse module."
To:
"The optparse module is deprecated and will not be developed further;
development will continue with the argparse module"

There's a lot of scripts using optparse, and if they are successfully
using it there's no reason to stop using it.  The proposed language
seems to imply it is wrong to keep using optparse, which I don't think
is the case.  And people can pick up on this kind of language and get
all excitable about it.

-- 
Ian Bicking  |  http://blog.ianbicking.org  |  http://topplabs.org/civichacker


More information about the Python-Dev mailing list