]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix incorrect statement about argparse.ArgumentParser.add_argument() (#145479)
authorJustin Kunimune <justinkunimune@gmail.com>
Tue, 3 Mar 2026 21:41:26 +0000 (16:41 -0500)
committerGitHub <noreply@github.com>
Tue, 3 Mar 2026 21:41:26 +0000 (21:41 +0000)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Doc/library/argparse.rst

index ca4f439c345f32f0cff2c33a213576be6229dfe6..8f31e815e0eb4b1fb9d703d1b147e487ef55045a 100644 (file)
@@ -739,9 +739,9 @@ By default, :mod:`!argparse` automatically handles the internal naming and
 display names of arguments, simplifying the process without requiring
 additional configuration.
 As such, you do not need to specify the dest_ and metavar_ parameters.
-The dest_ parameter defaults to the argument name with underscores ``_``
-replacing hyphens ``-`` . The metavar_ parameter defaults to the
-upper-cased name. For example::
+For optional arguments, the dest_ parameter defaults to the argument name, with
+underscores ``_`` replacing hyphens ``-``. The metavar_ parameter defaults to
+the upper-cased name. For example::
 
    >>> parser = argparse.ArgumentParser(prog='PROG')
    >>> parser.add_argument('--foo-bar')