On 2020-06-25 08:50, Anders Munch wrote:
Eric Nieuwland <eric.nieuwl...@gmail.com>:
I have some doubt about the keyword
Guido van Rossum [mailto:gu...@python.org]:
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).
I was thinking that 'match' and 'case' are reversed: The top line presents the
_case_ to be studied.  The patterns that follow try to _match_ the presented 
case.

Trying it out on PEP example:

case input:
     match x if x > MAX_INT:
         print("Got a large number")

I think it reads well, in particular when like here there's a condition
attached.  The second line is almost English: "match x if x greater than max
int".

Pascal is a precedent for this placement of 'case', although of course Niklaus
Wirth is not a native English speaker either.

Some languages use 'case' at the start of the construct; other languages use 'case' for the individual values. There are precedents for both placements.
_______________________________________________
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/R5QZSTDW2UIVYO32GT2L5UZTM7LHD4AU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to