Update to PEP308: if-then-else expression

John Roth johnroth at ameritech.net
Tue Feb 11 07:57:16 EST 2003


"Raymond Hettinger" <python at rcn.com> wrote in message
news:mailman.1044943071.22634.python-list at python.org...
> I updated the PEP for Guido van Rossum.
>
> If the cron job is doing its thing, the results will be visible in
> a few hours.

I see it. Great job!

> The update reflects updated thinking based on the discussion to-date.
> It also summarizes a few posts from comp.lang.python.
> Hopefully, it will serve to focus the discussion on the
> best of the ideas and arguments presented so far.
>
> * Out of order evaluation is out of favor.
>
> * So are ideas that do not provide for short-circuiting.
>
> * (if <condition>: <expression1> else: <condition2>) is in vogue.
>
> * <condition> ?? <expression1> || <expression2> is a new contender.
>
> * cond(<condition>, <expression1>, <condition2>) is viable if
implemented
>       as a keyword and has short-circuit behavior.  Note, the actual
word
>       is still an open question.  iif() got shot down quickly.
>
> * Added a summary of a few ideas from the last couple hundred posts
>       from comp.lang.python.

I prefer the ternary operator masquerading as a function,
however, the I find the actual proposal acceptable.

Which brings up an interesting idea - could we use acceptability
voting?

John Roth


>
>
> Raymond Hettinger
>






More information about the Python-list mailing list