[Python-checkins] argparse docs: prog default is the basename of argv[0] (GH-30298) (GH-30339)
rhettinger
webhook-mailer at python.org
Sun Jan 2 16:29:54 EST 2022
https://github.com/python/cpython/commit/74af713538463c9881e27b58bc4dbd67712c53f8
commit: 74af713538463c9881e27b58bc4dbd67712c53f8
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2022-01-02T13:29:35-08:00
summary:
argparse docs: prog default is the basename of argv[0] (GH-30298) (GH-30339)
files:
M Doc/library/argparse.rst
M Lib/argparse.py
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index a056826774c5e..d853d2afbe372 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 b2db312b8fdfd..e177e4fe034d3 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -1672,7 +1672,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
More information about the Python-checkins
mailing list