For review: PEP 308 - If-then-else expression
phr-n2003b at NOSPAMnightsong.com
Sat Feb 8 06:33:04 CET 2003
from_deja at alandaniels.com (Alan Daniels) writes:
> If use of the colon character is overloaded, how about just using the
> "else" keyword instead? That's what the colon in C's ternary operator
> essentially means anyway. So, we'd have something like:
> <condition> ? <expression1> else <expression2>
> A small compromise between the C-syntax and a more Pythonish syntax.
> I would find something like
> x = (y < 5) ? "Yep" else "Nope"
I like this.
More information about the Python-list