[Python-Dev] conditional expressions?
Walter D�rwald
walter@livinglogic.de
Tue, 16 Oct 2001 15:46:05 +0200
Guido van Rossum wrote:
> Even after reading Daniel's passionate plea, if(cond,expr,expr) looks
> ugly to me. It also doesn't solve the parsing ambiguity problem -- it
> still can't be allowed in an expression that starts a line because the
> parser doesn't know whether it's an if expression or an if statement
> without many tokens of lookahead.
This can be solved by simply choosing a different name:
iif(cond, expr, expr)
when(cond, expr, expr)
cond(cond, expr, expr)
check(cond, expr, expr)
...
> So, -1 for if(cond,expr,expr).
Bye,
Walter D�rwald