PyDocs

Nav

Command-line interface libraries

Option

  • Option(*opts, **attrs)
Instance attributes:
  _short_opts : [string]
  _long_opts : [string]

  action : string
  type : string
  dest : string
  default : any
  nargs : int
  const : any
  choices : [string]
  callback : function
  callback_args : (any*)
  callback_kwargs : { string : any }
  help : string
  metavar : string
Members of Option

a

action
(default: "store")
ACTIONS
All actions must be listed in ACTIONS.
ALWAYS_TYPED_ACTIONS
Actions that always take a type (i.e.

c

callback
For options with action "callback", the callable to call when this option is seen.
callback_args
Additional positional and keyword arguments to pass to callback after the four standard callback arguments.
callback_kwargs
Additional positional and keyword arguments to pass to callback after the four standard callback arguments.
choices
For options of type "choice", the list of strings the user may choose from.
const
For actions that store a constant value, the constant value to store.

d

default
The value to use for this option’s destination if the option is not seen on the command line.
dest
(default: derived from option strings)

h

help
Help text to print for this option when listing all available options after the user supplies a help option (such as --help).

m

metavar
(default: derived from option strings)

n

nargs
(default: 1)

s

STORE_ACTIONS
“store” actions are additionally listed here.

t

type
(default: "string")
TYPE_CHECKER
A dictionary mapping type names to type-checking functions.
TYPED_ACTIONS
“typed” actions are additionally listed here.
TYPES
A tuple of type names; in your subclass, simply define a new tuple TYPES that builds on the standard one.
0 Examples
No examples for optparse/Option.
See Also
No see-alsos for optparse/Option
0 Notes
No notes for Option