ternary operator

Andrew Koenig ark at research.att.com
Fri Feb 7 21:34:06 EST 2003


Carlos> c) that it can't be properly simulated by a function, because functions 
Carlos> evaluate their arguments at call time, UNLESS ...

Carlos> d) you have something called lazy evaluation ...

Carlos> e) which is something Python do not support.

Not directly, anyway.  You could do this:

        result iff(<cond>, lambda: expr1, lambda: expr2)

but in my opinion, the need to do it this way is a strong argument
in favor of the PEP.

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list