mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
[3.13] gh-65169: Clarify prog default in argparse (GH-31602) (#124430)
gh-65169: Clarify prog default in argparse (GH-31602)
(cherry picked from commit e69ff34e81
)
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
This commit is contained in:
parent
5615351a4b
commit
e5105ccbe1
1 changed files with 5 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue