[Python-Dev] Switch statement
Guido van Rossum
guido at python.org
Sun Jun 25 18:28:48 CEST 2006
More information about the Python-Dev mailing list
Sun Jun 25 18:28:48 CEST 2006
- Previous message: [Python-Dev] Switch statement
- Next message: [Python-Dev] Switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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/)
- Previous message: [Python-Dev] Switch statement
- Next message: [Python-Dev] Switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list