[Python-Dev] Re: PEP 622: capturing into an explicit namespace

2020年7月17日 16:07:24 -0700

On 18/07/20 4:34 am, Richard Levasseur wrote:
match get_point() into m:
  case Point(m.x, m.y):
   print(m.x, m.y)
  ...etc...
Personally, I thought this was a rather elegant solution to the load-vs-store problem for names. This is because, essentially, it changes the mental model from "some non-dotted names are special, some aren't, keep a careful eye out" to "only "m." is special, everything else is regular".
This is a variant of "mark the assignments, not the values", but
with the marking done in a somewhat subtle way that can potentially
change from one match statement to another. I have trouble seeing
this as an improvement over just picking a character to use for
the marking.
--
Greg
_______________________________________________
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/G2LOCBWEKHRH3PCUXDQFOBRJIZCVPTYW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to