something like "if" that returns a value?

Erik Max Francis max at alcyone.com
Mon Nov 11 17:58:43 EST 2002


John Roth wrote:

> The 'and' 'or' hack is the cannonical way of doing this. It short
> circuits properly, and it returns the value of the expression that was
> evaluated.

... but does not work as expected when the "then" expression evaluates
to false.  It's important to not forget that when using it, which is one
of the reasons it is unappealing.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Exercise is wonderful.  I could sit and watch it all day.
\__/ Louis Wu
    Fauxident / http://www.alcyone.com/pyos/fauxident/
 A "faux" ident daemon in Python



More information about the Python-list mailing list