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/053061.html below:

[Python-Dev] Re: switch statement

[Python-Dev] Re: switch statement [Python-Dev] Re: switch statementShane Hathaway shane at hathawaymix.org
Wed Apr 27 23:54:31 CEST 2005
Michael Chermside wrote:
>      if x == 1:        |    if condition_1:
>         do_1()         |        y = 1
>      elif x == 2:      |    elif condition_2:
>         do_2()         |        y = 2
>      elif x == 3:      |    elif condition_3:
>         do_3()         |        y = 3
>      else:             |    else:
>         default()      |        y = 4

This inspired a twisted thought: if you just redefine truth, you don't
have to repeat the variable. <0.9 wink>

    True = x
    if 1:
        do_1()
    elif 2:
        do_2()
    elif 3:
        do_3()
    else:
        default()

Shane
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