optparse has six built-in option types:
complex. If you need to add new option
types, see section 14.3.5, Extending optparse.
Arguments to string options are not checked or converted in any way: the text on the command line is stored in the destination (or passed to the callback) as-is.
Integer arguments (type
long) are parsed as follows:
0x, it is parsed as a hexadecimal number
0, it is parsed as an octal number
0b, it is parsed as a binary number
The conversion is done by calling either
the appropriate base (2, 8, 10, or 16). If this fails, so will optparse,
although with a more useful error message.
complex option arguments are converted directly with
complex(), with similar error-handling.
choice options are a subtype of
string options. The
option attribute (a sequence of strings) defines the set of allowed
user-supplied option arguments against this master list and raises
OptionValueError if an invalid string is given.
See About this document... for information on suggesting changes.