For review: PEP 308 - If-then-else expression
Andrew Koenig
ark at research.att.com
Sat Feb 8 10:09:05 EST 2003
Paul> You know, if the inspiration for this syntax (condition in the
Paul> middle) is list comprehensions, maybe the thing can be improved
Paul> by requiring parentheses around the expression:
Paul> (x if is_special(x) else y)
Paul> For some reason I find that clearer than the same thing without
Paul> the parens.
I thought of that too, but would hate to have to explain that the
compiler rejected
f(x if is_special(x) else y)
because you didn't write
f((x if is_special(x) else y))
--
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark
More information about the Python-list
mailing list