Skip to content

Commit 5143fd1

Browse files
Update pattern matching docs for changes to the PEP (#25185)
See: - python/peps#1909 (__match_args__ must be a tuple) - python/peps#1908 (allow keyword patterns for int(x) etc.)
1 parent 57c6cb5 commit 5143fd1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ subject value:
10301030

10311031
For a number of built-in types (specified below), a single positional
10321032
subpattern is accepted which will match the entire subject; for these types
1033-
no keyword patterns are accepted.
1033+
keyword patterns also work as for other types.
10341034

10351035
If only keyword patterns are present, they are processed as follows,
10361036
one by one:
@@ -1057,7 +1057,7 @@ subject value:
10571057

10581058
* If this raises an exception, the exception bubbles up.
10591059

1060-
* If the returned value is not a list or tuple, the conversion fails and
1060+
* If the returned value is not a tuple, the conversion fails and
10611061
:exc:`TypeError` is raised.
10621062

10631063
* If there are more positional patterns than ``len(cls.__match_args__)``,

Doc/reference/datamodel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2565,7 +2565,7 @@ define a *__match_args__* attribute.
25652565

25662566
.. data:: object.__match_args__
25672567

2568-
This class variable can be assigned a tuple or list of strings. When this class is
2568+
This class variable can be assigned a tuple of strings. When this class is
25692569
used in a class pattern with positional arguments, each positional argument will
25702570
be converted into a keyword argument, using the corresponding value in
25712571
*__match_args__* as the keyword. The absence of this attribute is equivalent to

0 commit comments

Comments
 (0)