[Python-Dev] Switch statement

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jun 12 03:03:34 CEST 2006


Talin wrote:
> Since you don't have the 'fall-through' behavior of C, I would also 
> assume that you could associate more than one value with a case, i.e.:
>> case 'a', 'b', 'c':
> ...

Multiple values could be written
 case 'a':
 case 'b':
 case 'c':
 ...
without conflicting with the no-fallthrough semantics, since
a do-nothing case can be written as
 case 'd':
 pass
> I don't have any specific syntax proposals, but I notice that the suite 
> that follows the switch statement is not a normal suite, but a 
> restricted one,

I don't see that as a problem. And all the proposed syntaxes
I've ever seen for putting the cases at the same level as
the switch look ugly to me.
--
Greg


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /