[Python-Dev] getopt helper?

Mark Hammond mhammond@skippinet.com.au
Sun, 3 Oct 1999 17:52:59 +1000


Greg writes:
> I still think it would be very desirable to tie the short and long
> options together.  Eg.
>
>   options = [('verbose', 'v'),
>              ('quiet', 'q'),
>              ('thingy', None),
>              (None, 'x')
>              ('output=', 'o:')]
>   opts, args = getopt_or_die (options, usage, ...)
>

Im not convinced this is worth it.  I only use "long options" when I
have too many, or a few obscure ones.  I have never have "-v"
synonymous for "--verbose" - why bother?  I know I would never type
the later:-)

The existing mechanism still handles this quite well - the standard
"if opt==blah:" simply becomes "if opt in [...]:" - no real drag.

Plus its less change for reasonable reward - handy enough I may
actually add command-line handling as I create each little test/util
script :-)

What say anyone else?  Go with my "little change", Gregs "only
slightly more change" or "don't worry about it"?

Mark.