On Thu, Nov 28, 2013 at 5:05 AM, Pavel Volkov <negai...@gmail.com> wrote: > "Got a switch statement? The Python translation is a hash table, not a bunch > of if-then statments. Got a bunch of if-then's that wouldn't be a switch > statement in Java because strings are involved? It's still a hash table. "
I actually disagree. There is no Python translation for a switch statement. What you have is two ways (if/elif and dict lookup) to implement what in other languages is often implemented with a switch. Often, switch is used when a dispatch table is the ideal solution; but other times, neither if/elif nor a dispatch table will perfectly cover what you're trying to do, and it's not right to "translate" the switch into a dict lookup. The right thing to do is to go back to what's actually trying to be solved, and solve that. ChrisA -- https://mail.python.org/mailman/listinfo/python-list