[Python-Dev] Re: switch statement

Stephen J. Turnbull stephen at xemacs.org
Tue Apr 26 10:55:10 CEST 2005


>>>>> "Greg" == Greg Ewing <greg.ewing at canterbury.ac.nz> writes:

    Greg> Two things are mildly annoying about if-elif chains as a
    Greg> substitute for a switch statement:

    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.


-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.


More information about the Python-Dev mailing list