The python way is to use a dictionary, or in simpler cases, if statements.
Your example falls short because case statements aren't such an obvious method of solving the problem as you think. They are nothing more than an artifact of the machine that C pushes up to you.
Some functions map multiple elements of their domain to single elements of their range. My pseudocode is a concise way to express such a function. It is not an artifact of the machine.
It's still absolutely no more difficult with if statements, and with if statements you don't have to worry about error prone fall through. There is no lack of consensus on how to do this. It's very obvious.
Comments
The python way is to use a dictionary, or in simpler cases, if statements.
Your example falls short because case statements aren't such an obvious method of solving the problem as you think. They are nothing more than an artifact of the machine that C pushes up to you.
Some functions map multiple elements of their domain to single elements of their range. My pseudocode is a concise way to express such a function. It is not an artifact of the machine.
It's still absolutely no more difficult with if statements, and with if statements you don't have to worry about error prone fall through. There is no lack of consensus on how to do this. It's very obvious.
Concise? I've got some perl code for you.
There's no error-prone fall through in the code I posted. You would advocate the following pseudocode?
I wouldn't advocate that. I think my first version is more concise in a clear way, not in a line-noise way.your formating fucking blows.