Thomas Wouters <thomas@xs4all.net>: > switch EXPR: > case CONSTANT: > [suite] > case CONSTANT: > [suite] > ... > else: Looks good, except that I'd indent the cases as well, i.e. switch EXPR: case CONSTANT: [suite] case CONSTANT: [suite] else: [suite] To my mind the cases are logically a subordinate part of the switch statement, and the indentation should reflect that. Some alternatives: Using only one keyword: case EXPR: CONSTANT: [suite] CONSTANT: [suite] else: [suite] Using two, but reminding one less of C: case EXPR: of CONSTANT: [suite] of CONSTANT: [suite] else: [suite] Possible refinements: * Multiple values in a case CONSTANT, CONSTANT, ..., CONSTANT: * Ranges in a case CONSTANT..CONSTANT: although that would require something other than a dict, maybe a binary search. Also could lead to arguments about whether the endpoint should be inclusive or exclusive! Maybe it should be spelt range(CONSTANT, CONSTANT): ? Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
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