diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2020-12-23 09:40:56 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-23 09:40:56 -0800 |
commit | 41b223d29cdfeb1f222c12c3abaccc3bc128f5e7 (patch) | |
tree | 817e48eaad3896b63163931a8fdbf3a03005dad1 /Doc/howto | |
parent | bpo-28468: Fix typo in _os_release_candidates (GH-23913) (diff) | |
download | cpython-41b223d29cdfeb1f222c12c3abaccc3bc128f5e7.tar.gz cpython-41b223d29cdfeb1f222c12c3abaccc3bc128f5e7.tar.bz2 cpython-41b223d29cdfeb1f222c12c3abaccc3bc128f5e7.zip |
bpo-9694: Fix misleading phrase "optional arguments" (GH-23858)
Diffstat (limited to 'Doc/howto')
-rw-r--r-- | Doc/howto/argparse.rst | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Doc/howto/argparse.rst b/Doc/howto/argparse.rst index 76d8e6be429..a97d10cfe6b 100644 --- a/Doc/howto/argparse.rst +++ b/Doc/howto/argparse.rst @@ -83,7 +83,7 @@ Following is a result of running the code: $ python3 prog.py --help usage: prog.py [-h] - optional arguments: + options: -h, --help show this help message and exit $ python3 prog.py --verbose usage: prog.py [-h] @@ -130,7 +130,7 @@ And running the code: positional arguments: echo - optional arguments: + options: -h, --help show this help message and exit $ python3 prog.py foo foo @@ -172,7 +172,7 @@ And we get: positional arguments: echo echo the string you use here - optional arguments: + options: -h, --help show this help message and exit Now, how about doing something even more useful:: @@ -241,7 +241,7 @@ And the output: $ python3 prog.py --help usage: prog.py [-h] [--verbosity VERBOSITY] - optional arguments: + options: -h, --help show this help message and exit --verbosity VERBOSITY increase output verbosity @@ -289,7 +289,7 @@ And the output: $ python3 prog.py --help usage: prog.py [-h] [--verbose] - optional arguments: + options: -h, --help show this help message and exit --verbose increase output verbosity @@ -332,7 +332,7 @@ And here goes: $ python3 prog.py --help usage: prog.py [-h] [-v] - optional arguments: + options: -h, --help show this help message and exit -v, --verbose increase output verbosity @@ -440,7 +440,7 @@ And the output: positional arguments: square display a square of a given number - optional arguments: + options: -h, --help show this help message and exit -v {0,1,2}, --verbosity {0,1,2} increase output verbosity @@ -468,7 +468,8 @@ verbosity argument (check the output of ``python --help``):: print(answer) We have introduced another action, "count", -to count the number of occurrences of a specific optional arguments: +to count the number of occurrences of specific options. + .. code-block:: shell-session @@ -489,7 +490,7 @@ to count the number of occurrences of a specific optional arguments: positional arguments: square display a square of a given number - optional arguments: + options: -h, --help show this help message and exit -v, --verbosity increase output verbosity $ python3 prog.py 4 -vvv @@ -626,7 +627,7 @@ Output: x the base y the exponent - optional arguments: + options: -h, --help show this help message and exit -v, --verbosity $ python3 prog.py 4 2 -v @@ -750,7 +751,7 @@ but not both at the same time: x the base y the exponent - optional arguments: + options: -h, --help show this help message and exit -v, --verbose -q, --quiet |