A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-April/053091.html below:

[Python-Dev] Re: switch statement

[Python-Dev] Re: switch statement [Python-Dev] Re: switch statementStephen J. Turnbull stephen at xemacs.org
Thu Apr 28 10:42:53 CEST 2005
>>>>> "Guido" == Guido van Rossum <gvanrossum at gmail.com> writes:

    Guido> You mean like this?

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

The salient example!  If it's no accident that those conditions are
mutually exclusive and exhaustive, doesn't that code require at least
a comment saying so, and maybe even an assertion to that effect?
Where you can use a switch, it gives both, and throws in economy in
both source and object code as a bonus.

Not a compelling argument---your example shows switches are not
universally applicable---but it's a pretty good deal.

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

Exaggeration in defense of elegance is no vice.<wink>

-- 
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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4