File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -839,15 +839,17 @@ how the command-line arguments should be handled. The supplied actions are:
839
839
>>> parser.parse_args(['--version'])
840
840
PROG 2.0
841
841
842
- Only actions that consume command-line arguments (e.g. ``'store' ``,
843
- ``'append' `` or ``'extend' ``) can be used with positional arguments.
842
+ Note that only actions that consume command-line arguments (e.g. ``'store' ``,
843
+ ``'append' `` or ``'extend' ``) can be used with positional arguments. You may
844
+ also specify an arbitrary action by passing an :class: `Action ` subclass or
845
+ other object that implements the same interface.
844
846
845
847
.. class :: BooleanOptionalAction
846
848
847
- You may also specify an arbitrary action by passing an :class: `Action ` subclass or
848
- other object that implements the same interface. The :class: ` !BooleanOptionalAction `
849
- is available in :mod: ` !argparse ` and adds support for boolean actions such as
850
- `` --foo `` and `` --no-foo `` ::
849
+ A subclass of :class: `Action ` for handling boolean flags with positive
850
+ and negative options. Adding a single argument such as `` --foo `` automatically
851
+ creates both `` --foo `` and `` --no-foo `` options, storing `` True `` and `` False ``
852
+ respectively ::
851
853
852
854
>>> import argparse
853
855
>>> parser = argparse.ArgumentParser()
You can’t perform that action at this time.
0 commit comments