Another conditional expression candidate (PEP 308)

Andrew Koenig ark at research.att.com
Mon Feb 10 00:04:53 EST 2003


Alan> Also, I think this would also be VERY confusing to new users.
Alan> This would be legal syntax:

Alan>     result = if cond: x else: y

Alan> But this...

Alan>     result = if cond:
Alan>         x
Alan>     else:
Alan>         y

Alan> ...would be illegal (it certainly is *now*, anyway). So to implement
Alan> this would require changing the fact that "if" blocks are not
Alan> expressions. Do I understand this correctly? Thanks.

Why is this any more confusing than the fact that

        result = x +
               y +
               z

is illegal?

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list