Where is CASE?????
larry at smith-house.org
Tue Feb 27 13:39:50 EST 2001
Erik Max Francis wrote:
> Not particularly. I come from C and C++, which have switch...case
> statements, and it isn't a big deal for them to be missing. Case
> statements are realy nothing more than glorified repeated if...else
> if... statements, and really don't have any more power (in fact, in C
> and C++, case statements have less).
Case statements can be modelled with if-else chains
but they are not the same internally. Case statements
are usually compiled as jump tables, rather than as a
series of if-elses. This is hugely faster than if-else
However, in Guido's defense, I will also point out the
primary use of case statements is to select alternatives
based on a type flag - which is not needed in an object
.-. .-. .---. .---. .-..-. | Do not mistake my cynicism
| |__ / | \| |-< | |-< > / | for dispair for deep inside
`----'`-^-'`-'`-'`-'`-' `-' | me is an optimist forever
http://www.smith-house.org/ | asking, "Why not?"
More information about the Python-list