[Python-Dev] School IIb?

Phillip J. Eby pje at telecommunity.com
Tue Jun 27 01:05:30 CEST 2006


At 03:52 PM 6/26/2006 -0700, Guido van Rossum wrote:
>It's the
>messiness of trying to define rules that are as flexible as needed for
>optimization and yet claiming to maintain the strict if/elif-chain
>semantics.

Hear, hear!  We already have if/elif, we don't need another way to spell 
it.  The whole point of switch is that it asserts that exactly *one* case 
is supposed to match -- which means by definition that the *order* of the 
cases must not matter.  It is an unprioritized selection, rather than 
sequential selection.

I think that probably the biggest misunderstanding of switch that has been 
put forth is that it's shorthand for a particular pattern of if-elif use, 
when in actuality it's the other way around: if-elif is sometimes used as a 
crude workaround for the absence of a switch feature.



More information about the Python-Dev mailing list