Skip to content

Commit 2912fcc

Browse files
[3.14] GH-106235: Clarify parse_known_args documentation by removing "remaining" (GH-126921) (#134913)
GH-106235: Clarify `parse_known_args` documentation by removing "remaining" (GH-126921) (cherry picked from commit a425141) Co-authored-by: Savannah Bailey <savannahostrowski@gmail.com>
1 parent 32574d4 commit 2912fcc

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Doc/library/argparse.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,12 +2122,15 @@ Partial parsing
21222122

21232123
.. method:: ArgumentParser.parse_known_args(args=None, namespace=None)
21242124

2125-
Sometimes a script may only parse a few of the command-line arguments, passing
2126-
the remaining arguments on to another script or program. In these cases, the
2127-
:meth:`~ArgumentParser.parse_known_args` method can be useful. It works much like
2128-
:meth:`~ArgumentParser.parse_args` except that it does not produce an error when
2129-
extra arguments are present. Instead, it returns a two item tuple containing
2130-
the populated namespace and the list of remaining argument strings.
2125+
Sometimes a script only needs to handle a specific set of command-line
2126+
arguments, leaving any unrecognized arguments for another script or program.
2127+
In these cases, the :meth:`~ArgumentParser.parse_known_args` method can be
2128+
useful.
2129+
2130+
This method works similarly to :meth:`~ArgumentParser.parse_args`, but it does
2131+
not raise an error for extra, unrecognized arguments. Instead, it parses the
2132+
known arguments and returns a two item tuple that contains the populated
2133+
namespace and the list of any unrecognized arguments.
21312134

21322135
::
21332136

0 commit comments

Comments
 (0)