Conditional expressions (again)

Erik Max Francis max at alcyone.com
Thu Oct 25 22:06:34 EDT 2001


Greg Ewing wrote:

> Write that as
> 
>    x = (
>       b if a else
>       d if c else
>       e
>    )
> 
> and it looks a lot clearer.

Sure, but since conditional expressions are intended for brevity, you've
just made a five line nested conditional express.  Why not just use an
if ... elif ... else statement instead?

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Men live by forgetting -- women live on memories.
\__/ T.S. Eliot
    Computer science / http://www.alcyone.com/max/reference/compsci/
 A computer science reference.



More information about the Python-list mailing list