Guido van Rossum wrote: > > [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. Oh, I did get the idea... just wanted to plug my module here in a take-it-or-leave-it way ;-) I usually put such things into my lib/ dir for Python to find -- no need to make them a standard. > 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? Better not: it's sometimes very useful to call the main(args) function of a script in interactive mode which then passes the args list to getopt(). How about adding something like: def getoptex(...,args=None,helptext='Read the source, Luke ;-)'): if args is None: args = sys.argv[1:] ... -- Marc-Andre Lemburg ______________________________________________________________________ Y2000: 92 days left Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4