Basically _every_ time I use getopt, I write code like this:
Why not just add a higher level interface ? Something like CommandLine.py which is included in mxDateTime ?
Because _every_ time I use getopt, I write code like that :-)
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 (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/)