Re: PEP 622: Structural Pattern Matching

Great PEP! I have some doubt about the keyword: ‘match’ seems to be at odds with ‘for’, ‘while’, ‘with’, ‘if’ as it is more of an action. It’s more like ‘try’ but that statement has a completely different structure. Not a native speaker I don’t have a reasonable alternative, though.

On Wed, Jun 24, 2020 at 7:30 AM Eric Nieuwland <eric.nieuwland@gmail.com> wrote:
Great PEP!
Thanks! I have some doubt about the keyword: ‘match’ seems to be at odds with
Well, 'try' is also an action. :-) Many people have tried to come up with a different keyword here, but nothing has been found that comes even close to the simplicity of match. Plus, several other languages (Scala, Rust) use it too (which is further evidence that it's a natural fit).
Not a native speaker I don’t have a reasonable alternative, though.
Me neither, but I speak it quite fluently now, and 'match' really feels like it fits well here. -- --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...>

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

On 06/24/2020 08:57 AM, misha@drach.uk wrote:
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
Python uses English words, but is not English. Having said that, you can "match against several cases" to see which one is what you are looking for: Google search, not sure which dictionary, said:
So in your example we have three cases of interest: - point is Point(?, 1) - point is Point(1, ?) - point is None So we are matching the point given against three different cases, and match <thing>: case <1>: # blah case <2>: # blah case <3>: # blah flows naturally from that. -- ~Ethan~

Better yet: given point: as (x, 1): ... as (1, y): ... as None: ...

On Wed, Jun 24, 2020 at 7:30 AM Eric Nieuwland <eric.nieuwland@gmail.com> wrote:
Great PEP!
Thanks! I have some doubt about the keyword: ‘match’ seems to be at odds with
Well, 'try' is also an action. :-) Many people have tried to come up with a different keyword here, but nothing has been found that comes even close to the simplicity of match. Plus, several other languages (Scala, Rust) use it too (which is further evidence that it's a natural fit).
Not a native speaker I don’t have a reasonable alternative, though.
Me neither, but I speak it quite fluently now, and 'match' really feels like it fits well here. -- --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...>

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

On 06/24/2020 08:57 AM, misha@drach.uk wrote:
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
Python uses English words, but is not English. Having said that, you can "match against several cases" to see which one is what you are looking for: Google search, not sure which dictionary, said:
So in your example we have three cases of interest: - point is Point(?, 1) - point is Point(1, ?) - point is None So we are matching the point given against three different cases, and match <thing>: case <1>: # blah case <2>: # blah case <3>: # blah flows naturally from that. -- ~Ethan~

Better yet: given point: as (x, 1): ... as (1, y): ... as None: ...
participants (5)
-
Eric Nieuwland
-
Ethan Furman
-
Guido van Rossum
-
Jakub Stasiak
-
misha@drach.uk