Skip to content

Commit e800dd1

Browse files
committed
argparse docs: prog default is the basename of argv[0]
1 parent d12bec6 commit e800dd1

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
@@ -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)