ternary operator

John Roth johnroth at ameritech.net
Thu Feb 6 02:26:31 CET 2003

"Grant Edwards" <grante at visi.com> wrote in message
news:3e418d36$0$147$a1866201 at newsreader.visi.com...
> 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?

Which is exactly the reason I suggested that it might be a good idea to
pursue some way of allowing a function to do lazy evaluation of its

A condition function would, as several people have said, be very
easy with that facility, and is the first use case. Hopefully, it's not
only use case, or it probably won't fly.

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

More information about the Python-list mailing list