> 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 would argue that all these beautiful properties of the other languages do not carry over to Python. E.g. in Prolog, you have only a two data types: structure, and list, and neither is opaque: since they are not objects, their state is all they have. In Python, the same can be said just about lists and tuples, perhaps dictionaries. Classes don't participate that easily in pattern matching: If you have x = httplib.HTTP() x.connect("foo.com") would you then expect that x matches httplib.HTTP(), or httplib.HTTP("foo.com")? In languages with pattern matching, you find that they use it to emulate late binding: depending on the structure of a thing, you perform different code. In Python, this is more easily done using methods of the object, which naturally dispatch based on the type of the object. 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