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/2006-June/066310.html below:

[Python-Dev] Switch statement

[Python-Dev] Switch statement [Python-Dev] Switch statementKa-Ping Yee python-dev at zesty.ca
Wed Jun 21 10:38:57 CEST 2006
On Wed, 21 Jun 2006, Phillip J. Eby wrote:
> Well, EIBTI and all that:
>
>      switch x:
>          case == 1: foo(x)
>          case in S: bar(x)
>
> It even lines up nicely.  :)

Hmm, this is rather nice.  I can imagine possible use cases for

    switch x:
        case > 3: foo(x)
        case is y: spam(x)
        case == z: eggs(x)

An interesting use case for which this offers no corresponding
syntax is

        case instanceof ClassA: ham(x)

which doesn't work because Python spells a type test as
isinstance(a, b) rather than with an operator.  (I suppose
whether we want it to be an operator might be another
question to think about for Python 3000.)


-- ?!ng
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