[Python-Dev] conditional expressions? (original) (raw)

Guido van Rossum guido@python.org
Tue, 16 Oct 2001 10:20:59 -0400


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) ...

-1 too.

(1) In order to do short-circuiting evaluation, the name would have to be recognized by the parser, which means it would have to be a new keyword. None of these keywords sound attractive.

(2) It looks too much like a function call for my comfort.

I still like

(if cond then expr else expr)

better than any of these.

--Guido van Rossum (home page: http://www.python.org/~guido/)