File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -728,6 +728,9 @@ how the command-line arguments should be handled. The supplied actions are:
728
728
729
729
.. versionadded :: 3.8
730
730
731
+ Only actions that consume command-line arguments (e.g. ``'store' ``,
732
+ ``'append' `` or ``'extend' ``) can be used with positional arguments.
733
+
731
734
You may also specify an arbitrary action by passing an Action subclass or
732
735
other object that implements the same interface. The ``BooleanOptionalAction ``
733
736
is available in ``argparse `` and adds support for boolean actions such as
@@ -855,6 +858,8 @@ See also :ref:`specifying-ambiguous-arguments`. The supported values are:
855
858
If the ``nargs `` keyword argument is not provided, the number of arguments consumed
856
859
is determined by the action _. Generally this means a single command-line argument
857
860
will be consumed and a single item (not a list) will be produced.
861
+ Actions that do not consume command-line arguments (e.g.
862
+ ``'store_const' ``) set ``nargs=0 ``.
858
863
859
864
860
865
.. _const :
You can’t perform that action at this time.
0 commit comments