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

[Python-Dev] Switch statement

[Python-Dev] Switch statement [Python-Dev] Switch statementGuido van Rossum guido at python.org
Sun Jun 25 18:28:48 CEST 2006
On 6/24/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
> [...] a syntactic nit that Eric Sumner pointed out. Since
> it involves iteration over x to populate the jump table rather than doing a
> containment test on x, using 'case in x' is misleading. It would be better
> written as 'case *x'.
>
> Then:
>    'case 1:'     ==> a switch value of 1 will jump to this case
>    'case 1, 2:'  ==> a switch value of 1 or 2 will jump to this case
>    'case *x'     ==> any switch value in x will jump to this case
>    'case *x, *y' ==> any switch value in x or y will jump to this case

I'm +0 on this idea, or something similar (maybe my original 'case in'
syntax with 'in' replaced by '*'.

I'm going to have to sleep on Nick's 'once' proposal (which deserves a
separate thread).

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
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