programming logical functions: myand, myor and mynot

John Roth johnroth at ameritech.net
Wed Nov 14 20:49:57 EST 2001


"Gernot" <headroom02 at gmx.de> wrote in message
news:9sv2c7$6qa$06$1 at news.t-online.com...
> Hi,
>
> I want to implement the functions myand, myor and mynot. They should
have
> the same effect as the known boolean operators and, or and not.
>
> The trick is that I am not allowed to use the boolean operators and,
or and
> not.
>
<example snipped>

AFIK, it can't be done because the 'and' and 'or' operators have
short circuit evaluation. There is no way to build a function that
does not evaluate each of its arguments before invoking the
function.

John Roth





More information about the Python-list mailing list