[Python-Dev] Switch statement

Phillip J. Eby pje at telecommunity.com
Wed Jun 21 07:31:35 CEST 2006


At 10:14 PM 6/20/2006 -0700, Guido van Rossum wrote:
>Hm, so this still doesn't help if you write
>
>   case S: ...
>
>(where S is an immutable set or sequence) when you meant
>
>   case in S: ...
>
>so I'm not sure if it's worth the subtleties.

Well, EIBTI and all that:

     switch x:
         case == 1: foo(x)
         case in S: bar(x)

It even lines up nicely.  :)



More information about the Python-Dev mailing list