For review: PEP 308 - If-then-else expression

Ian Bicking ianb at colorstudy.com
Sat Feb 8 15:51:32 EST 2003


On Saturday, February 8, 2003, at 10:54 AM, Aahz wrote:
> I've been flipping between -1 and +1 (going through -0 and +0) as 
> various
> arguments are put forth.  What's put me mostly in the -1 camp is the 
> use
> of the ternary operator in an if statement.  That's just too ugly for
> words.  I would be willing to abstain from (or possibly even vote for) 
> a
> proposal that reads left-to-right *and* doesn't muck with the if
> statement.  So far, the only proposals that work on those grounds are
>
>     <cond> ? <exp1> : <exp2>
>
> and
>
>     when <cond> then <exp1> else <exp2>

Don't forget cond ? exp1 else exp2

It actually reads decently when I think about it, though it may 
initially mislead people who are used to ?:.

   Ian






More information about the Python-list mailing list