[Python-Dev] Trinary Operators

Oren Tirosh oren-py-d@hishome.net
Fri, 7 Feb 2003 09:59:35 -0500


On Thu, Feb 06, 2003 at 01:08:44PM -0500, Guido van Rossum wrote:
> > 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. :-)

Oh dear. If you are really going to do these these cutesy English-like
expressions I'd have to resurrect my old proposal of:

if CONDITION for some NAME in ITERABLE:
if CONDITION for every NAME in ITERABLE:
if CONDITION for no NAME in ITERABLE:

Please, dont make me do that ;-)

        Oren