Skip to content

Commit 74af713

Browse files
argparse docs: prog default is the basename of argv[0] (GH-30298) (GH-30339)
1 parent 35955e4 commit 74af713

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Doc/library/argparse.rst

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
16721672
"""Object for parsing command line strings into Python objects.
16731673
16741674
Keyword Arguments:
1675-
- prog -- The name of the program (default: sys.argv[0])
1675+
- prog -- The name of the program (default:
1676+
``os.path.basename(sys.argv[0])``)
16761677
- usage -- A usage message (default: auto-generated from arguments)
16771678
- description -- A description of what the program does
16781679
- epilog -- Text following the argument descriptions

0 commit comments

Comments
 (0)