"Mark H. Harris" <harrismh...@gmail.com>: > I think the real issue is about the syntax... because of python's > unique indent strategy going back to ABC, a pythonized switch > statement would play havoc with the many text parsers out there used > for development (TestWrangler, and many others).
I also took a look at the proposals. I don't think it's the editor issue. The variant I proposed most recently: with self.state from Connection.State: if CONNECTING or CONNECTED: ... elif DISONNECTING: ... else: ... would be handled gracefully by all sane python editors, I believe. The main problem is that it can't be optimized effectively without bringing in an element of preprocessing. That preprocessing is done by the human developer with the dict dispatch table, but nothing in regular Python gives the compiler enough guaranteed information to build the dispatch table. There are ways to be smart, but it would be a lot of additional code for the compiler for a questionable performance gain. > a switch statement is just more readable to human beings that a dict > dispatch table, or a long if elif chain... and one of the main points > of python (going all the way back to ABC) was to make very highly > readable code. A dict dispatch table is just awful. At least have the decency of creating inner classes. ... which brings up the point for another post... Marko -- https://mail.python.org/mailman/listinfo/python-list