pavlovevidence at gmail.com
Fri Sep 2 07:42:08 CEST 2011
On Thursday, September 1, 2011 7:16:13 PM UTC-7, Roy Smith wrote:
> In article <mailman.666.13149139... at python.org>,
> Terry Reedy <tjr... at udel.edu> wrote:
> > Do note "The optparse module is deprecated and will not be developed
> > further; development will continue with the argparse module."
> One of the unfortunate things about optparse and argparse is the names.
> I can never remember which is the new one and which is the old one. It
> would have been a lot simpler if the new one had been named optparse2
> (in the style of unittest2 and urllib2).
It's easy: "opt"parse parses only "opt"ions (-d and the like), whereas "arg"parse parses all "arg"uments. argparse is the more recent version since it does more. optparse2 would have been a bad name for something that parses more than options.
(In fact, although I have some minor philosophical disagreements with optparse's design decisions, the main reason I always recommended using argparse instead was that optparse didn't handle positional arguments. optparse has all these spiffy features with type checking and defaults, but it never occurred to the optparse developers that this stuff would be useful for positional arugments, too. They just dropped the ball there.)
More information about the Python-list