[Python-Dev] Switch statement

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Jun 11 02:47:06 CEST 2006


skip at pobox.com wrote:
> switch raw_input("enter a, b or c: "):
> case 'a':
> print 'yay! an a!'
> case 'b':
> print 'yay! a b!'
> case 'c':
> print 'yay! a c!'
> else:
> print 'hey dummy! I said a, b or c!'

Before accepting this, we could do with some debate about the
syntax. It's not a priori clear that C-style switch/case is
the best thing to adopt.
--
Greg


More information about the Python-Dev mailing list

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