Newbie: Truth values (three-valued logic)

Greg Ewing greg.ewing at compaq.com
Sun Jun 20 22:48:48 CEST 1999


Tim Peters wrote:
> 
> Well, "and" and "or" do short-ciruit evaluation (i.e., they don't evaluate
> their right-hand operand at all if the value of their left-hand operand
> suffices to determine the result).  For that reason, they're more properly
> viewed as control structures than operators, and so unlikely to get "opened
> up" to user intervention.

It could be done if Python 2.0 gets lexical closures.
The __and__ and __or__ methods would get the value of
the left argument and a function for evaluating the
right argument. Then they could be lazy or not as
they pleased.

Greg




More information about the Python-list mailing list