Eric Nieuwland <[email protected]>:
>> I have some doubt about the keyword
Guido van Rossum [mailto:[email protected]]:
> 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.
regards, Anders
_______________________________________________
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/EGZSIBVCNXQSDS2LTYS2G6CN37K5M35E/
Code of Conduct: http://python.org/psf/codeofconduct/