On 2020-06-23 22:53, Emily Bowman wrote:
On Tue, Jun 23, 2020 at 2:10 PM MRAB <pyt...@mrabarnett.plus.com
<mailto:pyt...@mrabarnett.plus.com>> wrote:
I think that's done for consistency. '_' is a wildcard and you can
have:
case (_, _):
to match any 2-tuple, so:
case _:
would match any value, and can thus already serve as the default.
I wouldn't object to 'else', though.
Can you have case (x,x): ? I haven't tried the implementation, but
it's not addressed in the PEP that I see, and if that's legal, then _
is effectively just a style choice, rather than a functional one, and
there's no reason it shouldn't also be a named match.
You cannot bind to the same name twice, so "case (x,x):"is an error.
+1 for including "else:" for consistency even if that's just a shim
for "case _:"
_______________________________________________
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/6KXFMJ3M372GJO6UI5GFSAKETTNUF5HO/
Code of Conduct: http://python.org/psf/codeofconduct/