Eval of expr with 'or' and 'and' within

Nobody nobody at nowhere.com
Fri Jun 14 19:02:56 EDT 2013


On Fri, 14 Jun 2013 19:30:27 +0000, Grant Edwards wrote:

>  2. Returning one the objects that result from the evaluation of the
>     operands instead of returning True or False.
> 
>     This is what seems to be confusing him.  This is much less common
>     than short-circuit evaluation.

FWIW, Lisp also does this. But Lisp is slightly simpler as the only false
value is "nil", while everything else is true (including integer zero).

Although Python's any() and all() (which are closer to Lisp's "and" and
"or" insofar as they all work with any number of values, including zero)
always return True or False rather than the final value.




More information about the Python-list mailing list