On this page
optparse.OptionContainer
Prev: optparse.OptionConflictError | Up: optparse | Next: optparse.OptionError
Rel: optparse.BadOptionError, optparse.check_choice, optparse.HelpFormatter, optparse.IndentedHelpFormatter
Ref: docs.python.org — optparse.OptionContainer
Tags: #public #python3 #stdlib #optparse
Import
import optparse
from optparse import OptionContainer
Signature & Overview
optparse.OptionContainer(option_class, conflict_handler, description)
Abstract base class.
Methods & Attributes
OptionContainer.add_option(self, *args, **kwargs)— add_option(opt_str, ..., kwarg=val, ...)OptionContainer.add_options(self, option_list)—OptionContainer.add_optionsmethod/property.OptionContainer.destroy(self)— see OptionParser.destroy().OptionContainer.format_description(self, formatter)—OptionContainer.format_descriptionmethod/property.OptionContainer.format_help(self, formatter)—OptionContainer.format_helpmethod/property.OptionContainer.format_option_help(self, formatter)—OptionContainer.format_option_helpmethod/property.OptionContainer.get_description(self)—OptionContainer.get_descriptionmethod/property.OptionContainer.get_option(self, opt_str)—OptionContainer.get_optionmethod/property.OptionContainer.has_option(self, opt_str)—OptionContainer.has_optionmethod/property.OptionContainer.remove_option(self, opt_str)—OptionContainer.remove_optionmethod/property.OptionContainer.set_conflict_handler(self, handler)—OptionContainer.set_conflict_handlermethod/property.OptionContainer.set_description(self, description)—OptionContainer.set_descriptionmethod/property.
Usage
import optparse
assert issubclass(optparse.OptionParser, optparse.OptionContainer)
assert issubclass(optparse.OptionGroup, optparse.OptionContainer)
Gotchas
- Shared base class of
OptionParserandOptionGroup.
REPL Inspect
from optparse import OptionContainer
help(OptionContainer)
Linked from
Related notes
- tuts/python3/stdlib_module/optparse/OptionConflictError Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionError Linked here; links to this page; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/optparse/BadOptionError Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/check_choice Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/HelpFormatter Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/IndentedHelpFormatter Linked here; shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/make_option shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/Option shared tags: #optparse, #stdlib
- tuts/python3/stdlib_module/optparse/OptionGroup shared tags: #optparse, #stdlib