Skip to content

Commit e5105cc

Browse files
[3.13] pythongh-65169: Clarify prog default in argparse (pythonGH-31602) (python#124430)
pythongh-65169: Clarify prog default in argparse (pythonGH-31602) (cherry picked from commit e69ff34) Co-authored-by: Stanley <[email protected]>
1 parent 5615351 commit e5105cc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Doc/library/argparse.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,12 @@ The following sections describe how each of these are used.
249249
prog
250250
^^^^
251251

252-
By default, :class:`ArgumentParser` objects use ``sys.argv[0]`` to determine
252+
By default, :class:`ArgumentParser` objects use the base name
253+
(see :func:`os.path.basename`) of ``sys.argv[0]`` to determine
253254
how to display the name of the program in help messages. This default is almost
254-
always desirable because it will make the help messages match how the program was
255-
invoked on the command line. For example, consider a file named
256-
``myprogram.py`` with the following code::
255+
always desirable because it will make the help messages match the name that was
256+
used to invoke the program on the command line. For example, consider a file
257+
named ``myprogram.py`` with the following code::
257258

258259
import argparse
259260
parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)