[Chicago] Option Parsers, was: Re: __name__ == "__main__"

Pete pfein at pobox.com
Sat Oct 27 02:13:02 CEST 2007

On Friday October 26 2007 5:25:59 pm skip at pobox.com wrote:
> Replacing getopt with optparse if I get *really* formal.  (I know optparse
> is "better" for some definition of that word, but my fingers know how to
> type getopt-using code with little or no involvement on the part of my
> brain.)

And argparse is better than optparse: http://argparse.python-hosting.com/

Basically, it takes all of the common things you do with optparse, and sticks 
them in a library.  Both in terms of option parsing & basic post-processing 
of the options afterwards (opening a file, say).

Though my favorite feature is easy svn-style subcommands.


Peter Fein   ||   773-575-0694   ||   pfein at pobox.com
http://www.pobox.com/~pfein/   ||   PGP: 0xCCF6AE6B
irc: pfein at freenode.net   ||   jabber: peter.fein at gmail.com

More information about the Chicago mailing list