[issue42128] Structural Pattern Matching (PEP 634)

Brandt Bucher report at bugs.python.org
Fri Mar 12 20:13:05 EST 2021


Brandt Bucher <brandtbucher at gmail.com> added the comment:

Not a much thought went into that decision, honestly.

The main reason I chose an identifier there was because "as" always stores a simple name, so allowing it to potentially be other contexts or expressions (which are illegal) just seemed to create complexity. I saw we used simple identifiers in many similar places and just went with it.

(As a related note, if mapping patterns had their own AST nodes, I would probably choose to represent "**rest" as an optional identifier, rather than a keyless value or optional Name.)

If it causes problems for clients of the AST, it's easy to change. But I sort of like it a bit better how it is now.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42128>
_______________________________________


More information about the Python-bugs-list mailing list