From e800dd1793dafbc4114da744f605731ff6630623 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Wed, 29 Dec 2021 18:32:22 -0800 Subject: [PATCH] argparse docs: prog default is the basename of argv[0] --- Doc/library/argparse.rst | 3 ++- Lib/argparse.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 80c382a981b8d4..e050d6298b6ff6 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 de95eedbee0ee6..1529d9e7687373 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