Skip to content

Commit 09ceaa6

Browse files
[3.13] GH-141963: Clarify argparse documentation (GH-141964) (#142077)
GH-141963: Clarify argparse documentation (GH-141964) Clarify argparse documentation Tightens the phrasing for several argparse actions. (cherry picked from commit cfcd524) Co-authored-by: Moshe Kaplan <mosheekaplan@gmail.com>
1 parent 1247113 commit 09ceaa6

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
@@ -676,9 +676,9 @@ how the command-line arguments should be handled. The supplied actions are:
676676
Namespace(foo=42)
677677

678678
* ``'store_true'`` and ``'store_false'`` - These are special cases of
679-
``'store_const'`` used for storing the values ``True`` and ``False``
680-
respectively. In addition, they create default values of ``False`` and
681-
``True`` respectively::
679+
``'store_const'`` that respectively store the values ``True`` and ``False``
680+
with default values of ``False`` and
681+
``True``::
682682

683683
>>> parser = argparse.ArgumentParser()
684684
>>> parser.add_argument('--foo', action='store_true')
@@ -698,8 +698,8 @@ how the command-line arguments should be handled. The supplied actions are:
698698
>>> parser.parse_args('--foo 1 --foo 2'.split())
699699
Namespace(foo=['0', '1', '2'])
700700

701-
* ``'append_const'`` - This stores a list, and appends the value specified by
702-
the const_ keyword argument to the list; note that the const_ keyword
701+
* ``'append_const'`` - This appends the value specified by
702+
the const_ keyword argument to a list; note that the const_ keyword
703703
argument defaults to ``None``. The ``'append_const'`` action is typically
704704
useful when multiple arguments need to store constants to the same list. For
705705
example::
@@ -710,8 +710,8 @@ how the command-line arguments should be handled. The supplied actions are:
710710
>>> parser.parse_args('--str --int'.split())
711711
Namespace(types=[<class 'str'>, <class 'int'>])
712712

713-
* ``'extend'`` - This stores a list and appends each item from the multi-value
714-
argument list to it.
713+
* ``'extend'`` - This appends each item from a multi-value
714+
argument to a list.
715715
The ``'extend'`` action is typically used with the nargs_ keyword argument
716716
value ``'+'`` or ``'*'``.
717717
Note that when nargs_ is ``None`` (the default) or ``'?'``, each
@@ -725,7 +725,7 @@ how the command-line arguments should be handled. The supplied actions are:
725725

726726
.. versionadded:: 3.8
727727

728-
* ``'count'`` - This counts the number of times a keyword argument occurs. For
728+
* ``'count'`` - This counts the number of times an argument occurs. For
729729
example, this is useful for increasing verbosity levels::
730730

731731
>>> parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)