PEP 622: Add exception semantics (#1491)

This commit is contained in:
Daniel F Moisset 2020-07-02 22:47:45 +01:00 committed by GitHub
parent 2bedd36c45
commit 127fc3701e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -629,6 +629,16 @@ Only match-by-name will work by default, and classes should define
match-by-position. Additionally, dataclasses and named tuples will
support match-by-position out of the box. See below for more details.
Exception semantics
-------------------
While matching each case, the ``match`` statement may trigger execution of other
functions (for example ``__getitem__()``, ``__len__()`` or
a property). Almost every exception caused by those propagates outside of the
match statement normally. The only case where an exception is not propagated is
an ``AttributeError`` raised while trying to lookup an attribute while matching
attributes of a Class Pattern; that case results in just a matching failure,
and the rest of the statement proceeds normally.
The standard library
--------------------