PEP 308: Alternative conditional operator forms

John Roth johnroth at ameritech.net
Mon Feb 10 07:53:27 EST 2003


"Paul Rubin" <phr-n2003b at NOSPAMnightsong.com> wrote in message
news:7xel6hrlys.fsf at ruckus.brouhaha.com...
> Erik Max Francis <max at alcyone.com> writes:
> > Here is the list I have so far (C represents the conditional
expression,
> > x the if-true expression, y the if-false one):
> >
> > x if C else y # initial proposition in PEP
> > C ? x ! y # mentioned in PEP
> > (if C then x else y) # mentioned in PEP
> > x when C else y
> > (if C: x else: y)
> > C ? x else y
> > C -> x else y
> > C -> (x, y)
> >
> > What else should be on this list?  (You can reply by email if you
wish.)
>
> cond(C, :x, :y)  and some variants on this which I don't remember
exactly
>
> Numerous other deferred evaluation schemes

I thoroughly agree. If I had to choose between deferred evaluation and
any
of the conditional expressions, I'd go with the functional version in a
flash.
I consider it so much clearer that there's simply no comparison.

> A few macro schemes from threads gone by

Well, if you're trying to be completist, but any kind of macro scheme
gets my thumbs down.

John Roth






More information about the Python-list mailing list