My .02 on PEP308 + an extra question.

Mel Wilson mwilson at the-wire.com
Mon Feb 10 23:10:53 CET 2003


In article <aeR1a.805$PC1.148 at tornadotest1.news.pas.earthlink.net>,
"Adonis" <adonisv at earthlink.net> wrote:
>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
>...
[ ... ]
>
>or am I getting the concept all wrong?

   You, too, are getting the concept all wrong,
Try

    import math
    x = -1.0
    iif (x >= 0.0, math.sqrt(x), 0.0)

and see what you see.

   How many people are left out there who are still going to
think this up?

        Regards.    Mel.




More information about the Python-list mailing list