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 -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/7XCJ356PV3E36L33K6GJCUYZD2P2KCIQ/ Code of Conduct: http://python.org/psf/codeofconduct/