Python style questions

Joshua Marshall jmarshal at mathworks.com
Mon Mar 19 14:51:58 EST 2001


Michael Hudson <mwh21 at cam.ac.uk> wrote:
> cobrien at Radix.Net (Cary O'Brien) writes:
...
> The scoping can get a bit counter-intuitive
>> 3. I really miss not having a "switch" or "case" statement.  Sniff.

> -- 
> 3. Syntactic sugar causes cancer of the semicolon.
>   -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html

A switch statement may just be syntactic sugar, but not necessarily in
a simple way.  A good compiler will compile switch statements into
jump-tables or, at worst, binary searches.  Cluttery to code by hand.

Sure this is "just" an efficiency thing, but switches can get quite big.



More information about the Python-list mailing list