Another stab at a "switch/case" construct (for Python 3000):

Peter Hansen peter at engcorp.com
Fri Mar 29 11:16:05 EST 2002


Benjamin Schollnick wrote:
> 
> We have the IF .... ELIF statement structure, which can be used to
> simulate a case statement, but it is not as clear nor as neat as
> the case statement.
> 
> IF X == 0:
>    DO_THIS ()
> ELIF X == 2:
>    DO_THIS (2)

What language is this?  It has a style similar to Python, with the
colon and indentation marking blocks, but Python doesn't have the
keywords IF and ELIF.  (Case-sensitive!)

(You were probably trying to make it more readable or something.
Please don't --  it makes it less readable to those familiar with
reading Python.)

-Peter



More information about the Python-list mailing list