Python's optparse for human beings
Apr 30, 2009, 00:03 (0 Talkback[s])
How to Help Your Business Become an AI Early Adopter
[ Thanks to Alexander Sandler for this
"Every time we use optparse, we use it to do a number
of things. Obviously we want our program to support command line
options. What varies is the type of options we want to support.
Some options doesn’t have additional arguments (boolean
options). Others are mandatory. Some require one or more arguments.
Finally, we may want options to depend on each other - i.e. we may
want one option to depend on presence of another.
"These are most common things that we would like to implement,
but there are more. Lets try to build a list of all such
functionalities that we may want to implement.
"Support for a standalone command line options (boolean
Support for mandatory (required) options.
Support for options with one or more arguments.
Default values for options.
Dependency between options.
Grouping of options in help screen.
Customizing help screen.
"However, before we dig into implementation details of each and
every one of these bullets, lets see the basics of using