I've just added named pattern (x := <pattern>) support to the reference implementation.
While working on this, I realized that the PEP is a bit vague. Should we always bind the value to x, or only on a successful match? I believe the intent is to bind only on success (and this is how it's implemented), but I wonder if others disagree.
I've just added named pattern (
x := <pattern>
) support to the reference implementation.While working on this, I realized that the PEP is a bit vague. Should we always bind the value to
x
, or only on a successful match? I believe the intent is to bind only on success (and this is how it's implemented), but I wonder if others disagree.