PEP 634: expand section on side effects and undefined behavior
This commit is contained in:
parent
1f6931b81d
commit
d3f060d0ca
13
pep-0634.rst
13
pep-0634.rst
|
@ -517,8 +517,8 @@ This behavior is roughly equivalent to the following::
|
|||
return self
|
||||
|
||||
|
||||
Side Effects
|
||||
============
|
||||
Side Effects and Undefined Behavior
|
||||
===================================
|
||||
|
||||
The only side-effect produced explicitly by the matching process is
|
||||
the binding of names. However, the process relies on attribute
|
||||
|
@ -530,6 +530,15 @@ proposal intentionally leaves out any specification of what methods
|
|||
are called or how many times. This behavior is therefore undefined
|
||||
and user code should not rely on it.
|
||||
|
||||
Another undefined behavior is the binding of variables by capture
|
||||
patterns that are followed (in the same case block) by another pattern
|
||||
that fails. These may happen earlier or later depending on the
|
||||
implementation strategy, the only constraint being that capture
|
||||
variables must be set before guards that use them explicitly are
|
||||
evaluated. If a guard consists of an ``and`` clause, evaluation of
|
||||
the operands may even be interspersed with pattern matching, as long
|
||||
as left-to-right evaluation order is maintained.
|
||||
|
||||
|
||||
The Standard Library
|
||||
====================
|
||||
|
|
Loading…
Reference in New Issue