ternary operator

Erik Max Francis max at alcyone.com
Fri Feb 7 00:44:25 CET 2003

"Christopher A. Craig" wrote:

> You like (b, c)[not a] better?  I generally don't write code like
> that, but it is more compact than the prefered way and anything is
> better than the perl-line-noise-eqsue ternery work alikes that are
> available.

The main drive for a conditional operator is one which serves as an
expression, so the traditional solution involving an if...else statement
is sort of missing the point.

 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ War is like love, it always finds a way.
\__/ Bertolt Brecht
    Bosskey.net: Return to Wolfenstein / http://www.bosskey.net/rtcw/
 A personal guide to Return to Castle Wolfenstein.

More information about the Python-list mailing list