a 'case' statement?

Michael Hudson mwh at python.net
Fri Feb 14 09:07:39 EST 2003


"Wouter van Marle" <wouterm at spammers-unite-here.com> writes:

> I miss something like Pascal's case: statement! (probably my Pascal
> syntax is not correct, it's too long ago, it was a very very handy
> one anyway!)

You're not the first.  There are occasional murmurings about this (you
might be able to google for them; try 'python switch' as well), but
noone has come up with a really compelling argument for adding them.
If the statement is just syntactic sugar for a chain of if/elifs then
I for one don't see the point.

As others mentioned, there's usually some reasonably nice way to get
want you want done, even if it's not the one you thought of at first.

Cheers,
M.

-- 
  Important data should not be entrusted to Pinstripe, as it may
  eat it and make loud belching noises.
   -- from the announcement of the beta of "Pinstripe" aka. Redhat 7.0




More information about the Python-list mailing list