diff options
author | Stanley <46876382+slateny@users.noreply.github.com> | 2024-09-24 10:57:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 10:57:37 (GMT) |
commit | e69ff34e81eceb69de6623205c87e0145f1831e4 (patch) | |
tree | 3d6af19aa4fc6dfe3462e815c0d9ba8f6144d7b5 /Doc | |
parent | e670a113b5e1fcc3ce3bb9b5b4b1f126264ae21b (diff) | |
download | cpython-e69ff34e81eceb69de6623205c87e0145f1831e4.zip cpython-e69ff34e81eceb69de6623205c87e0145f1831e4.tar.gz cpython-e69ff34e81eceb69de6623205c87e0145f1831e4.tar.bz2 |
gh-65169: Clarify prog default in argparse (GH-31602)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/argparse.rst | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index c4e2dbc..f22aeb8 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -249,11 +249,12 @@ The following sections describe how each of these are used. prog ^^^^ -By default, :class:`ArgumentParser` objects use ``sys.argv[0]`` to determine +By default, :class:`ArgumentParser` objects use the base name +(see :func:`os.path.basename`) of ``sys.argv[0]`` to determine how to display the name of the program in help messages. This default is almost -always desirable because it will make the help messages match how the program was -invoked on the command line. For example, consider a file named -``myprogram.py`` with the following code:: +always desirable because it will make the help messages match the name that was +used to invoke the program on the command line. For example, consider a file +named ``myprogram.py`` with the following code:: import argparse parser = argparse.ArgumentParser() |