[Python-Dev] getopt helper?

Guido van Rossum guido@CNRI.Reston.VA.US
Thu, 30 Sep 1999 08:35:23 -0400


[Mark]
> > > > Basically _every_ time I use getopt, I write code like this:

[Marc-Andre]
> > > Why not just add a higher level interface ? Something
> > > like CommandLine.py which is included in mxDateTime ?

[Mark]
> > Because _every_ time I use getopt, I write code like that :-)

[Marc-Andre]
> I wrote the CommandLine.py for pretty much the same reason:

Marc-Andre, you're not hearing what Mark is saying.  He wants a change
to the standard library, and he knows that small additions to existing
modules there stand a better chance of adoption than new modules.

I personally liked the idea of getoptex() best, except I would call it 
getopt_or_die().  If the usage message is omitted it can synthesize
one from the (short and long) options arguments and sys.argv[0] (the
latter being a bit controversial, but it's just a default).

Hmm...  Perhaps getopt_or_die() shouldn't take the args argument but
extract sys.argv[1:] itself?

--Guido van Rossum (home page: http://www.python.org/~guido/)