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 fc9b11f commit 5587646Copy full SHA for 5587646
1 file changed
Doc/library/argparse.rst
@@ -953,6 +953,10 @@ is used when no command-line argument was present::
953
>>> parser.parse_args([])
954
Namespace(foo=42)
955
956
+Because ``nargs='*'`` gathers any supplied values into a list, an absent
957
+positional argument yields an empty list (``[]``). Only a non-``None``
958
+*default* overrides this (so ``default=None`` still gives ``[]``).
959
+
960
For required_ arguments, the ``default`` value is ignored. For example, this
961
applies to positional arguments with nargs_ values other than ``?`` or ``*``,
962
or optional arguments marked as ``required=True``.
0 commit comments