> I'm not sure how your proposal fits in here, but it looks like > the current if-elif-else syntax is better suited to it than > some trying to use a switch-dictionary with some special objects > to implement wild-card matching, e.g. The wildcard object isn't very important; the part that matters is being able to take structures apart using case clauses. Also, this is mostly about syntactical convenience - for certain problems, pattern-matched case statements read better and are less error-prone than if-then-elif syntax. But I need to come up with a better example. Anyway, my main point is just to argue in favor of switch syntax rather than looking for special cases of if-then-elif to optimize. Some languages do some very elegant things with switches that Python might want to implement someday. (I do appreciate that the dictionary optimization only works for the simple case though, so comparison to constants is the only part that's needed to start.) - Brian
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