Update to PEP308: if-then-else expression

Michele Simionato mis6 at pitt.edu
Tue Feb 11 19:20:07 CET 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.
> 
> 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.

somebody proposed 

  <condition> then <expression1> else <expression2>

which is also viable if "then" is made a pseudo keyword analogous to "as"

> 
> * 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.
> 
> 
> Raymond Hettinger




More information about the Python-list mailing list