Conditional operator in Python?

Erik Max Francis max at alcyone.com
Tue Sep 4 11:15:12 EDT 2001


Michael Abbott wrote:

> I think (though it would need a bit of careful checking) that there is
> no
> conflict with the existing Python syntax in making
> 
>         if <expr> then <expr> else <expr>
> 
> an expression.
> 
> Perhaps adding this to the syntax could be a PEP?

That seems pretty reasonable to me.  I've been itching for a conditional
operator in Python for quite some time.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Education is a state-controlled manufactory of echoes.
\__/ Norman Douglas
    Kepler's laws / http://www.alcyone.com/max/physics/kepler/
 A proof of Kepler's laws.



More information about the Python-list mailing list