From: Justin Kunimune Date: Tue, 3 Mar 2026 21:41:26 +0000 (-0500) Subject: Fix incorrect statement about argparse.ArgumentParser.add_argument() (#145479) X-Git-Tag: v3.15.0a7~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc12d1999b88e84d5a6b8e491be468b73379e54b;p=thirdparty%2FPython%2Fcpython.git Fix incorrect statement about argparse.ArgumentParser.add_argument() (#145479) Co-authored-by: Savannah Ostrowski --- diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index ca4f439c345f..8f31e815e0eb 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -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')