[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020年7月31日 00:03:15 -0700

On 7/30/20 4:31 PM, Caleb Donovick wrote:
However if the capture was explicit and any valid target could be used as a capture variable then I could express this cleanly: |def update_point_3d(p: Point3d, pt): match pt: case (p.x=, p.y=): pass case Point2d(p.x=, p.y=): pass ... |
I like this proposal, using = to explicitly specify when capturing. I see it as a big improvement over the current PEP where dotted names are never assigned to and non-dotted names usually are. It also leads directly to an alternate proposal for the wildcard pattern: a "=" not prefaced with an lvalue. This has the benefit of having no conflict with i18n, etc.
Explicit is better than implicit,
//arry/
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/7XCJ356PV3E36L33K6GJCUYZD2P2KCIQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to