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

Simon Burton simonb at
Sat Feb 8 11:38:55 CET 2003

+1 from me.

after this:
"[ x for x in range(10) if is_special(x) ]",

to have this ternary construct:
"x if is_special(x) else y"

seems reasonable enough.

Perhaps the "else <expr2>" can default to "else None".

Simon Burton.

More information about the Python-list mailing list