Skip to content

Commit d8a72b4

Browse files
[3.14] GH-141963: Clarify argparse documentation (GH-141964) (#142076)
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 20b910c commit d8a72b4

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

770770
* ``'store_true'`` and ``'store_false'`` - These are special cases of
771-
``'store_const'`` used for storing the values ``True`` and ``False``
772-
respectively. In addition, they create default values of ``False`` and
773-
``True`` respectively::
771+
``'store_const'`` that respectively store the values ``True`` and ``False``
772+
with default values of ``False`` and
773+
``True``::
774774

775775
>>> parser = argparse.ArgumentParser()
776776
>>> parser.add_argument('--foo', action='store_true')
@@ -790,8 +790,8 @@ how the command-line arguments should be handled. The supplied actions are:
790790
>>> parser.parse_args('--foo 1 --foo 2'.split())
791791
Namespace(foo=['0', '1', '2'])
792792

793-
* ``'append_const'`` - This stores a list, and appends the value specified by
794-
the const_ keyword argument to the list; note that the const_ keyword
793+
* ``'append_const'`` - This appends the value specified by
794+
the const_ keyword argument to a list; note that the const_ keyword
795795
argument defaults to ``None``. The ``'append_const'`` action is typically
796796
useful when multiple arguments need to store constants to the same list. For
797797
example::
@@ -802,8 +802,8 @@ how the command-line arguments should be handled. The supplied actions are:
802802
>>> parser.parse_args('--str --int'.split())
803803
Namespace(types=[<class 'str'>, <class 'int'>])
804804

805-
* ``'extend'`` - This stores a list and appends each item from the multi-value
806-
argument list to it.
805+
* ``'extend'`` - This appends each item from a multi-value
806+
argument to a list.
807807
The ``'extend'`` action is typically used with the nargs_ keyword argument
808808
value ``'+'`` or ``'*'``.
809809
Note that when nargs_ is ``None`` (the default) or ``'?'``, each
@@ -817,7 +817,7 @@ how the command-line arguments should be handled. The supplied actions are:
817817

818818
.. versionadded:: 3.8
819819

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

823823
>>> parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)