diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-01-02 21:29:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-02 21:29:35 (GMT) |
commit | 74af713538463c9881e27b58bc4dbd67712c53f8 (patch) | |
tree | 10b91b1dad12bb1adde654993a5fd074d86c94d6 | |
parent | 35955e4adec4dd09127af93f9413d46889a3c475 (diff) | |
download | cpython-74af713538463c9881e27b58bc4dbd67712c53f8.zip cpython-74af713538463c9881e27b58bc4dbd67712c53f8.tar.gz cpython-74af713538463c9881e27b58bc4dbd67712c53f8.tar.bz2 |
argparse docs: prog default is the basename of argv[0] (GH-30298) (GH-30339)
-rw-r--r-- | Doc/library/argparse.rst | 3 | ||||
-rw-r--r-- | Lib/argparse.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index a056826..d853d2a 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 b2db312..e177e4f 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 |