Hi Guido,

On 02/04/2021 2:38 am, Guido van Rossum wrote:
On Thu, Apr 1, 2021 at 2:18 PM Mark Shannon <m...@hotpy.org <mailto:m...@hotpy.org>> wrote:

    On 31/03/2021 9:53 pm, Guido van Rossum wrote:
     > On Wed, Mar 31, 2021 at 12:08 PM Mark Shannon <m...@hotpy.org
    <mailto:m...@hotpy.org>
     > <mailto:m...@hotpy.org <mailto:m...@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.

Checking for uniqueness is almost free because __match_args__ is a tuple, and therefore immutable, so the check can be done at class creation time.


    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.)

I thought matching `int(real=0+0j, imag=0-0j)` was a bit weird too.

The change required to make it work is trivial, but the code seems more consistent if `int(real=0+0j, imag=0-0j)` is disallowed, which is why I went for that.



    
https://github.com/python/cpython/compare/master...markshannon:pep-653-implementation?expand=1#diff-490b4f3b911cb4ca281e9ca6ff814bc10d331f0421f6c6971b08d9f29020620b
    
<https://github.com/python/cpython/compare/master...markshannon:pep-653-implementation?expand=1#diff-490b4f3b911cb4ca281e9ca6ff814bc10d331f0421f6c6971b08d9f29020620b>



--
--Guido van Rossum (python.org/~guido <http://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-change-the-world/>
_______________________________________________
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/2ACKZY2J7OVP4WELBIFLLGR7343AEQA7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to