Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit19b31d1

Browse files
[3.13]GH-106235: Clarifyparse_known_args documentation by removing "remaining" (GH-126921) (#134914)
GH-106235: Clarify `parse_known_args` documentation by removing "remaining" (GH-126921)(cherry picked from commita425141)Co-authored-by: Savannah Bailey <savannahostrowski@gmail.com>
1 parent5fd62be commit19b31d1

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
@@ -2013,12 +2013,15 @@ Partial parsing
20132013

20142014
..method::ArgumentParser.parse_known_args(args=None, namespace=None)
20152015

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

20232026
::
20242027

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp