[Python-Dev] Trinary Operators

Guido van Rossum guido@python.org
Thu, 06 Feb 2003 13:08:44 -0500


> Guido> I think I've seen the suggestion
> 
> Guido>     x = (y if y>z else z)
> 
> Guido> :-)
> 
> That's not bad, even though it looks Perlish :-)
> 
> It has the advantage of looking like a list comprehension.
> 
> I presume the parentheses would be mandatory.

Maybe I should write a PEP and let the folks in c.l.py vote on it,
just for fun.  (I expect to get about as many yes votes as no votes. :-)

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