[Python-Dev] Re: Request for comments on final version of PEP 653 (Precise Semantics for Pattern Matching)

2021年4月01日 19:57:08 -0700

On 4/1/2021 9:38 PM, Guido van Rossum wrote:
On Thu, Apr 1, 2021 at 2:18 PM Mark Shannon <[email protected] <mailto:[email protected]>> wrote:
 Almost all the changes come from requiring __match_args__ to be a tuple
 of unique strings.
The current posted PEP does not say 'unique' and I agree with Guido that it should not.
Ah, *unique* strings. Not sure I care about that. Explicitly checking for that seems extra work,
The current near-Python code does not have such a check.
and I don't see anything semantically suspect in allowing that.
If I understand the current pseudocode correctly, the effect of 's' appearing twice in 'C.__match_args__ would be to possibly look up and assign C.s to two different names in a case pattern. I would not be surprised if someone someday tries to do this intentionally. Except for the repeated lookup, it would be similar to a = b = C.s. This might make sense if C.s is mutable. Or the repeated lookups could yield different values.
--
Terry Jan Reedy
_______________________________________________
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/YAVWTPHGTUDUAOGXDISPKYVD4QMED2HB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to