From: Jade Lovelace Date: Sun, 2 Jan 2022 20:16:25 +0000 (-0800) Subject: argparse docs: prog default is the basename of argv[0] (GH-30298) X-Git-Tag: v3.11.0a4~107 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e75c6b49b7cb8515b917f01b32ece8c8ea2c0a0;p=thirdparty%2FPython%2Fcpython.git argparse docs: prog default is the basename of argv[0] (GH-30298) --- diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 80c382a981b8..e050d6298b6f 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -148,7 +148,8 @@ ArgumentParser objects as keyword arguments. Each parameter has its own more detailed description below, but in short they are: - * prog_ - The name of the program (default: ``sys.argv[0]``) + * prog_ - The name of the program (default: + ``os.path.basename(sys.argv[0])``) * usage_ - The string describing the program usage (default: generated from arguments added to parser) diff --git a/Lib/argparse.py b/Lib/argparse.py index de95eedbee0e..1529d9e76873 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1691,7 +1691,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): """Object for parsing command line strings into Python objects. Keyword Arguments: - - prog -- The name of the program (default: sys.argv[0]) + - prog -- The name of the program (default: + ``os.path.basename(sys.argv[0])``) - usage -- A usage message (default: auto-generated from arguments) - description -- A description of what the program does - epilog -- Text following the argument descriptions