We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6544bf4 commit 1f9516aCopy full SHA for 1f9516a
1 file changed
Doc/library/argparse.rst
@@ -1052,6 +1052,10 @@ is used when no command-line argument was present::
1052
>>> parser.parse_args([])
1053
Namespace(foo=42)
1054
1055
+Because ``nargs='*'`` collects matched values into a list, an absent positional
1056
+argument yields an empty list (``[]``); a default of ``None`` is replaced by
1057
+``[]``, although any other default is used as given.
1058
+
1059
For required_ arguments, the ``default`` value is ignored. For example, this
1060
applies to positional arguments with nargs_ values other than ``?`` or ``*``,
1061
or optional arguments marked as ``required=True``.
0 commit comments