ternary operator

Grant Edwards grante at visi.com
Wed Feb 5 17:16:22 EST 2003


In article <ad052e5c.0302051330.1efb9a10 at posting.google.com>, Dan Bishop wrote:

> I don't see the need to add a special operator for
> non-short-circuiting conditionals.  It would be to sufficent to
> make a function like this standard:
> 
> def cond(selector, valTrue, valFalse):
>    if selector:
>       return valTrue
>    return valFalse

Righ, that's easy enough, but how many bugs will be cause by
people forgetting that it doesn't short-circuit?

-- 
Grant Edwards                   grante             Yow!  Sometime in 1993
                                  at               NANCY SINATRA will lead a
                               visi.com            BLOODLESS COUP on GUAM!!




More information about the Python-list mailing list