diff options
author | Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> | 2021-04-06 16:03:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 16:03:00 (GMT) |
commit | 5143fd15b4fe5e122c79e3be4745031f17bb4d8e (patch) | |
tree | 2f27bd2ed229a56b15284ef3acd54284b8346f18 /Doc/reference/compound_stmts.rst | |
parent | 57c6cb5100d19a0e0218c77d887c3c239c9ce435 (diff) | |
download | cpython-5143fd15b4fe5e122c79e3be4745031f17bb4d8e.zip cpython-5143fd15b4fe5e122c79e3be4745031f17bb4d8e.tar.gz cpython-5143fd15b4fe5e122c79e3be4745031f17bb4d8e.tar.bz2 |
Update pattern matching docs for changes to the PEP (#25185)
See:
- https://github.com/python/peps/pull/1909 (__match_args__ must be a tuple)
- https://github.com/python/peps/pull/1908 (allow keyword patterns for int(x) etc.)
Diffstat (limited to 'Doc/reference/compound_stmts.rst')
-rw-r--r-- | Doc/reference/compound_stmts.rst | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index e13d6dd..aae7c7f 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -1030,7 +1030,7 @@ subject value: For a number of built-in types (specified below), a single positional subpattern is accepted which will match the entire subject; for these types - no keyword patterns are accepted. + keyword patterns also work as for other types. If only keyword patterns are present, they are processed as follows, one by one: @@ -1057,7 +1057,7 @@ subject value: * If this raises an exception, the exception bubbles up. - * If the returned value is not a list or tuple, the conversion fails and + * If the returned value is not a tuple, the conversion fails and :exc:`TypeError` is raised. * If there are more positional patterns than ``len(cls.__match_args__)``, |