Skip to content

Commit 238aa62

Browse files
authored
Improving readability of argparse.rst (GH-91751)
Fixed few typos and enhanced few paragraphs for your review and consideration. Trivial contribution towards continuous improvement, so no issue was raised. Automerge-Triggered-By: GH:rhettinger
1 parent 5dcfb91 commit 238aa62

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Doc/library/argparse.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
The :mod:`argparse` module makes it easy to write user-friendly command-line
2323
interfaces. The program defines what arguments it requires, and :mod:`argparse`
2424
will figure out how to parse those out of :data:`sys.argv`. The :mod:`argparse`
25-
module also automatically generates help and usage messages and issues errors
26-
when users give the program invalid arguments.
25+
module also automatically generates help and usage messages. The module
26+
will also issue errors when users give the program invalid arguments.
2727

2828

2929
Core Functionality
@@ -91,8 +91,8 @@ produces either the sum or the max::
9191
args = parser.parse_args()
9292
print(args.accumulate(args.integers))
9393

94-
Assuming the Python code above is saved into a file called ``prog.py``, it can
95-
be run at the command line and provides useful help messages:
94+
Assuming the above Python code is saved into a file called ``prog.py``, it can
95+
be run at the command line and it provides useful help messages:
9696

9797
.. code-block:: shell-session
9898
@@ -119,7 +119,7 @@ the command-line integers:
119119
$ python prog.py 1 2 3 4 --sum
120120
10
121121
122-
If invalid arguments are passed in, it will issue an error:
122+
If invalid arguments are passed in, an error will be displayed:
123123

124124
.. code-block:: shell-session
125125
@@ -159,7 +159,7 @@ used when :meth:`~ArgumentParser.parse_args` is called. For example::
159159

160160
Later, calling :meth:`~ArgumentParser.parse_args` will return an object with
161161
two attributes, ``integers`` and ``accumulate``. The ``integers`` attribute
162-
will be a list of one or more ints, and the ``accumulate`` attribute will be
162+
will be a list of one or more integers, and the ``accumulate`` attribute will be
163163
either the :func:`sum` function, if ``--sum`` was specified at the command line,
164164
or the :func:`max` function if it was not.
165165

@@ -555,7 +555,7 @@ disallowed.
555555
fromfile_prefix_chars
556556
^^^^^^^^^^^^^^^^^^^^^
557557

558-
Sometimes, for example when dealing with a particularly long argument lists, it
558+
Sometimes, when dealing with a particularly long argument lists, it
559559
may make sense to keep the list of arguments in a file rather than typing it out
560560
at the command line. If the ``fromfile_prefix_chars=`` argument is given to the
561561
:class:`ArgumentParser` constructor, then arguments that start with any of the
@@ -1228,7 +1228,7 @@ Any container can be passed as the *choices* value, so :class:`list` objects,
12281228
Use of :class:`enum.Enum` is not recommended because it is difficult to
12291229
control its appearance in usage, help, and error messages.
12301230

1231-
Formatted choices overrides the default *metavar* which is normally derived
1231+
Formatted choices override the default *metavar* which is normally derived
12321232
from *dest*. This is usually what you want because the user never sees the
12331233
*dest* parameter. If this display isn't desirable (perhaps because there are
12341234
many choices), just specify an explicit metavar_.

0 commit comments

Comments
 (0)