My .02 on PEP308 + an extra question.

Adonis adonisv at earthlink.net
Mon Feb 10 12:23:18 EST 2003


How about something like:

x = iif(cond, true, false)

BUT, why mingle with all this when anyone can simply make it?

>>> def iif(cond, ctrue, cfalse):
...     if cond: return ctrue
...     else: return cfalse
...
>>> y = 7
>>> x = iif(y==1, True, False)
>>> x
False
>>> y = 1
>>> x = iif(y==1, True, False)
>>> x
True
>>>

or am I getting the concept all wrong?

Adonis






More information about the Python-list mailing list