Voting for PEP 308 (was Re: For review: PEP 308 - If-then-else expression)
Roy Smith
roy at panix.com
Tue Feb 11 20:31:24 EST 2003
Hans Nowak <wurmy at earthlink.net> wrote:
> Hmm, what if bools grew an if() method? We could then write:
>
> z = (x == y).if(whentrue, whenfalse)
>
> This strikes me as much more elegant than the other proposals.
>
> (ducking for cover, etc :-)
A fascinating idea. Unfortunately, it doesn't achieve the short-circuit
behavior which many people feel is an essential aspect of the ternary
expression.
More information about the Python-list
mailing list