From 149e49f4aca2a22046b0e4fbd0152be406501591 Mon Sep 17 00:00:00 2001 From: "py.user" Date: Mon, 8 Apr 2019 02:17:22 +1100 Subject: [PATCH] bpo-27992: Clarify %(prog)s in argparse help formatter default for sys.argv[0] In the argparse docs there is a misleading words about %(prog)s value. The documentation says it should print full string from sys.argv[0] by default, but it prints basename of the path in sys.argv[0]. --- Doc/library/argparse.rst | 2 +- Lib/argparse.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index cef197f3055581..0c2bae97d4c9a3 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -148,7 +148,7 @@ 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: basename of ``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 798766f6c4086a..d711086408847b 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1598,7 +1598,7 @@ 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: basename of 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