Skip to content

Commit cfcd524

Browse files
authored
GH-141963: Clarify argparse documentation (GH-141964)
Clarify argparse documentation Tightens the phrasing for several argparse actions.
1 parent 890fe5a commit cfcd524

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

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

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

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

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

817817
.. versionadded:: 3.8
818818

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

822822
>>> parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)