]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] Fix incorrect statement about argparse.ArgumentParser.add_argument() (GH-14547...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 3 Mar 2026 21:47:39 +0000 (22:47 +0100)
committerGitHub <noreply@github.com>
Tue, 3 Mar 2026 21:47:39 +0000 (21:47 +0000)
Fix incorrect statement about argparse.ArgumentParser.add_argument() (GH-145479)
(cherry picked from commit dc12d1999b88e84d5a6b8e491be468b73379e54b)

Co-authored-by: Justin Kunimune <justinkunimune@gmail.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Doc/library/argparse.rst

index b80f0d2900599eb8266b48a7235b1c2dbb7cdf5c..2b2bf0a9d6eca80dc3ba796e1aa0087bbedbde53 100644 (file)
@@ -732,9 +732,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')