Equivalent to (a ? b : c) ?
Anders M Eriksson
anders.eriksson at morateknikutveckling.se
Tue Dec 21 04:39:00 EST 1999
On Mon, 20 Dec 1999 11:25:07 -0600 (CST), Skip Montanaro
<skip at mojam.com> wrote:
>
>Regarding C's
>
> (a?b:c)
>
<snip>
>
> def ternaryif(a, b, c):
> if a: return b
> return c
>
>folks need to remember that in C's construct, only one of b or c are ever
>evaluated, depending only on the value of a. Of the options I've seen
>posted this morning, only the rather obtuse
Now I'm confused! in the ternaryif function how will both b and c be
evaluated?
// Anders
More information about the Python-list
mailing list