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

Paul Rubin phr-n2003b at
Sat Feb 8 06:33:04 CET 2003

from_deja at (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 mailing list