On 01 October 1999, Mark Hammond said:
OK - general agreement. Wheee :-)
How about this:
def getopt_or_die(opts, long_opts=, usage=None, prog_name=None, args=None, exit_code = 1):
if usage is None, we build a very simple usage string from opts/long_opts.
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, ...)
Then opts would have possible keys 'verbose', 'quiet', 'thingy', 'x', and 'value' -- never 'v', 'q', or 'o'
(Look, I restrained my tendency to invent type systems and auto-generate help text. There may be hope for me yet.)