On Wed, Jun 24, 2020 at 2:04 AM Guido van Rossum firstname.lastname@example.org wrote:
def http_error(status): match status: case 404: return "Not found" case 418: return "I'm a teapot" case _: return "Something else"
Note the last block: the "variable name" `_` acts as a *wildcard* and never fails to match.
I can't find it among the rejected alternatives, but was it considered to use "..." as the wildcard, rather than "_"? It carries similar meaning but its special case of "this will never be bound" is simply preventing an error, rather than making one otherwise-valid name special.
Raw strings and byte strings are supported. F-strings are not allowed (since in general they are not really literals).
It won't come up often, but are triple-quoted strings allowed?