PEP 308: ternary operator
Peter Hansen
peter at engcorp.com
Fri Feb 21 13:09:17 EST 2003
sismex01 at hebmex.com wrote:
>
> OTOH, there's something to be said about helping to keep
> our favorite coding language/environment pollution-free,
> while helping evolve.
>
> Dont'cha think?
I have to agree. So far, very few (perhaps none... I'm still thinking
about it) of the proposals "feel like Python" to me. In fact, I'm
tempted to say only Guido's original feels like Python, and I think I'm
sitting on the fence between voting "no to any change" and "yes only
to the original" in spite of my concern about the order of operands
in the original.
I like your reminder about Python being "executable pseudocode". The
original and *maybe* one of the new alternatives feel like that still.
The C-style ternary simply does not.
Actually, "(true-expr) when (cond-expr) else (false-expr)" is perhaps
my favourite over even the original, which I think bothers me more
with its "if" in the middle. I'm inclined to think at least some small
bit of code uses "when" as a keyword, mind you... :-(
-Peter
More information about the Python-list
mailing list