> Isn't PEP 643 for PEG grammar pattern matching? (I'm talking about
> switch statements in Python)
I think you are referring to PEP 634, the one I linked to. I suggest you
read it (and the other link I sent).
I copy from PEP 636, marked as a sort of "tutorial" for PEP 634:
```
A match statement takes an expression and compares its value to
successive patterns given as one or more case blocks. This is
superficially similar to a switch statement in C, Java or JavaScript
(and many other languages), but much more powerful.
The simplest form compares a subject value against one or more literals:
def http_error(status):
match status:
case 400:
return "Bad request"
case 404:
return "Not found"
case 418:
return "I'm a teapot"
case _:
return "Something's wrong with the Internet"
```
- DLD
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/IGRJ5W6K3G6B5AM4JRHLYRTLPG2FIIKP/
Code of Conduct: http://python.org/psf/codeofconduct/