PEP 622: Add exception semantics (#1491)
This commit is contained in:
parent
2bedd36c45
commit
127fc3701e
10
pep-0622.rst
10
pep-0622.rst
|
@ -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
|
||||
--------------------
|
||||
|
|
Loading…
Reference in New Issue