[getopt-sig] More about commands on the command line

Greg Ward gward@python.net
Tue, 12 Mar 2002 18:29:37 -0500


On 12 March 2002, Russ Cox said:
> Back to more mundane things, Greg, why do you
> think that there should be both the list interface
> and the .add_option interface?

Silly historical reasons, probably dating back to the Getopt::Tabular
Perl module I wrote about five years ago.  add_option() was added when I
realized how easy and elegant it was, which is why the documentation
favours it.

> Why not make the
> parser a subclass of list instead?

Nah, I'd rather say add_option() than append().  It's clearer that way.
I rarely see a burning need to treat an OptionParser as a list of
options.  Yes, order matters so that the help looks sensible, but that's
about it.

        Greg
-- 
Greg Ward - nerd                                        gward@python.net
http://starship.python.net/~gward/
"Question authority!"  "Oh yeah?  Says who?"