Skip to content

Commit 8e75c6b

Browse files
authored
argparse docs: prog default is the basename of argv[0] (GH-30298)
1 parent ba00f0d commit 8e75c6b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Doc/library/argparse.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ ArgumentParser objects
148148
as keyword arguments. Each parameter has its own more detailed description
149149
below, but in short they are:
150150

151-
* prog_ - The name of the program (default: ``sys.argv[0]``)
151+
* prog_ - The name of the program (default:
152+
``os.path.basename(sys.argv[0])``)
152153

153154
* usage_ - The string describing the program usage (default: generated from
154155
arguments added to parser)

Lib/argparse.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
16911691
"""Object for parsing command line strings into Python objects.
16921692
16931693
Keyword Arguments:
1694-
- prog -- The name of the program (default: sys.argv[0])
1694+
- prog -- The name of the program (default:
1695+
``os.path.basename(sys.argv[0])``)
16951696
- usage -- A usage message (default: auto-generated from arguments)
16961697
- description -- A description of what the program does
16971698
- epilog -- Text following the argument descriptions

0 commit comments

Comments
 (0)