boolean xor

Andrew Dalke dalke at acm.org
Thu Jan 11 02:07:31 EST 2001


Delaney, Timothy:
>This can be done even better ...
>
>def xor (a, b):
> return (not a)!= (not b)
>
>getting rid of one negation ;)

Ooh, I like it.  It's even better than my use of
operator.truth because it doesn't have the function
call lookup and overhead.

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list