This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients BTaskaya, Guido.van.Rossum, Mark.Shannon, brandtbucher, freundTech, ncoghlan, pablogsal
Date 2021-04-20.23:48:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Content covers the rationale for why it is potentially problematic to reuse expression nodes for match patterns: it doesn't semantically align with the fact that patterns are *not* expressions, so the AST ends up being closer to a concrete syntax tree than we would like.

For the specifics of the AST nodes:

* restricting sub expressions directly in the AST itself is tricky without side effects on the AST for non-pattern-matching code, so I'm intending to add any such restrictions that we want to enforce to the validator (other statements and expressions like yield, await, return, break, and continue already have separately enforced restrictions like that)
* cls needs to be an expression node to allow for attribute lookups
* the linked draft PR already updates the grammar to emit the new AST. MatchClass is able to collect the keyword args and their corresponding patterns in roughly the same way that MatchMapping collects its key:pattern pairs
Date User Action Args
2021-04-20 23:48:56ncoghlansetrecipients: + ncoghlan, Mark.Shannon, Guido.van.Rossum, pablogsal, brandtbucher, BTaskaya, freundTech
2021-04-20 23:48:56ncoghlansetmessageid: <>
2021-04-20 23:48:56ncoghlanlinkissue43892 messages
2021-04-20 23:48:56ncoghlancreate