On Wed, 24 Jun 2020 at 19:49, M.-A. Lemburg <m...@egenix.com> wrote: > match something: > case 0 | 1 | 2 | _: > print("Small number or something else") > case [] | [_]: > print("A short sequence") > case _: > print("Not sure what this is") > case str() | bytes(): > print("Something string-like") >
Because the semantics is "first matching clause applies", putting `case _` anywhere but at the end wouldn't work as expected. The `str() | bytes()` case above would never match. Paul _______________________________________________ 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/YZOMXXY5XCADTTXBUMDE2KA6PCVCNEJP/ Code of Conduct: http://python.org/psf/codeofconduct/