[Python-Dev] Re: switch statement

Guido van Rossum gvanrossum at gmail.com
Tue Apr 26 11:24:53 CEST 2005


>     Greg> 1) Repeating the name of the thing being switched on all the
>     Greg> time, and the operator being used for comparison.
> 
> What's worse, to my mind, is the not infrequent case where the thing
> being switched on or the operator changes.  Sure, that's bad style,
> but sometimes you have to read other people's code like that.

You mean like this?

    if x > 0:
       ...normal case...
    elif y > 0:
        ....abnormal case...
    else:
        ...edge case...

You have guts to call that bad style! :-)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list