]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] GH-87358: Add clarification about nargs and default argparse behaviour (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 24 Sep 2024 17:15:21 +0000 (19:15 +0200)
committerGitHub <noreply@github.com>
Tue, 24 Sep 2024 17:15:21 +0000 (20:15 +0300)
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Doc/library/argparse.rst

index 4f4a29bfd55cb8973a9cce6546a127467eebdd57..8ed44fc809f7b47850c2c959805094415aebe7ff 100644 (file)
@@ -1121,6 +1121,9 @@ is used when no command-line argument was present::
    >>> parser.parse_args([])
    Namespace(foo=42)
 
+For required_ arguments, the ``default`` value is ignored. For example, this
+applies to positional arguments with nargs_ values other than ``?`` or ``*``,
+or optional arguments marked as ``required=True``.
 
 Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if the
 command-line argument was not present::