Greetings
Question for you. Does python suffer from a lack of switch / case statement in your opinions. I say yes, if / elif is OK but seems very inelegant to me.
Your opinions please.
Mark
Greetings
Question for you. Does python suffer from a lack of switch / case statement in your opinions. I say yes, if / elif is OK but seems very inelegant to me.
Your opinions please.
Mark
I do not believe so and here is why.
If I had many cases to test, I can use the dictionary list and simply use that in place of a case. The IF condition would be the key with the result being the value. A very elegant piece of code because dictionary lookup is fast(binary lookup I think). BTW, I used this technique in SAS on a mainframe(old dinosaur still in use). Oops I am dating myself.
Clem