From 385ef931f1649573e952207f6a5d85314048aa03 Mon Sep 17 00:00:00 2001 From: Justin Kunimune Date: Tue, 3 Mar 2026 16:41:26 -0500 Subject: [PATCH] Fix incorrect statement about argparse.ArgumentParser.add_argument() (GH-145479) (cherry picked from commit dc12d1999b88e84d5a6b8e491be468b73379e54b) Co-authored-by: Justin Kunimune Co-authored-by: Savannah Ostrowski --- Doc/library/argparse.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index b80f0d2900599e..2b2bf0a9d6eca8 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -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')