On Thu, Apr 1, 2021 at 2:18 PM Mark Shannon wrote:
On 31/03/2021 9:53 pm, Guido van Rossum wrote:
On Wed, Mar 31, 2021 at 12:08 PM Mark Shannon mailto:mark@hotpy.org> wrote:
[snip]
Apart from that, I think the semantics are so similar once you've
added
__match_seq__/__match_map__ to PEP 634 that is hard to claim one is better than the other. My (unfinished) implementation of PEP 653 makes almost no changes to the test suite.
I'd like to see where those differences are -- then we can talk about which is better. :-)
Almost all the changes come from requiring __match_args__ to be a tuple of unique strings.
Ah, *unique* strings. Not sure I care about that. Explicitly checking for that seems extra work, and I don't see anything semantically suspect in allowing that.
The only other change is that
case int(real=0+0j, imag=0-0j):
fails to match 0, because `int` is `MATCH_SELF` so won't match attributes.
Oh, but that would be a problem. The intention wasn't that "self" mode prevents keyword/attribute matches. (FWIW real and imag should attributes should not be complex numbers, so that testcase is weird, but it should work.)
https://github.com/python/cpython/compare/master...markshannon:pep-653-imple...
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...