PEP 308 - ternary operator

Raymond Hettinger vze4rx4y at verizon.net
Tue Feb 11 15:49:38 EST 2003


"Erik Max Francis" <max at alcyone.com> wrote in message
news:3E48B45F.A7E2881A at alcyone.com...
> Jim Jinkins wrote:
>
> > My preference for an immediate-if operator is the traditional '?' from
> > C:
> >
> >     cond ? expr1 : expr2
> ...
> > If this is not acceptable my second choice is a functional form:
> >     iif(cond, expr1, expr2)
> >
> > This is not a function, it is a built-in macro.
>
> Both of these forms have been explicitly rejected by the BDFL, although
> for different reasons; check the current state of the PEP.

Actually, he's wavering on both.
However, the second form would
be implemented with a keyword
instead of a macro, but the effect
would be the same.  Also, "iif"
looks like a typo to him, so it
would have to be "cond", "test",
or some such.


Raymond Hettinger

Raymond Hettinger






More information about the Python-list mailing list