> >> switch x: > >> case 'foo': > >> ... > >> case 'bar': > >> ... > >> case 42: > >> ... > > If you restrict the case values to hashable literals do you need "case"? I'm not going to draft a language extension here :-) Syntactically, you don't need it - even if you allow arbitrary complex expressions: you probably wouldn't allow any statements directly nested into the switch. It may be that switch x: if 'foo': ... elif 'bar': ... is also acceptable, and doesn't need the new keyword. > One new keyword would be easier than two for Guido to swallow... You'd introduce it through a __future__ import, so it wouldn't matter if it is one or two. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4