[Python-Dev] Re: PEP 622: Structural Pattern Matching
To me match also sound confusing as a keyword. You don't match things to cases in English. Maybe match x: against 1? https://idioms.thefreedictionary.com/match+against match point: against (x, 1): ... against (1, y): ... Better yet it feels to me to have: handle point: as (x, 1): ... as (1, y): ... as None: ... ___ 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/LGPOSO6L2GUFMR2RZ6YMAECGG4TMPIZD/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: PEP 622: Structural Pattern Matching
Better yet: given point: as (x, 1): ... as (1, y): ... as None: ... ___ 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/RWKM3YA4G7VVGAJCODSP56Y2G2MLFCSE/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: PEP 622: Structural Pattern Matching
I really dislike the fact that case with is instance check looks like
instantiation.
case Node(children=[…])
Along with checks for int or enum cases, "is instance” and attribute checks
like the one above will be perceived as equality check.
Basically what happens is based on context the round brackets () next to the
class name mean different things, which will confuse people a lot.
If instead the curly brackets {}were used for "match checks” the code would be
more explicit about not being an equality check:
case Node{children=[…]}
___
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/KHYARYHNPA5DFMGXX3TYJSDC3FSPU4VH/
Code of Conduct: http://python.org/psf/codeofconduct/
