24 Jun
2020
24 Jun
'20
10:19 p.m.
On Wed, 24 Jun 2020 at 19:49, M.-A. Lemburg
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