bborcic at gmail.com
Mon Nov 26 17:47:27 CET 2007
> Grant Edwards wrote:
>> The user-defined xor is operates on "logical" boolean values.
>> The one in the operator module is a bitwise operator.
> def xor(a, b):
> return bool(a) ^ bool(b)
> seems more explicit to me.
> maybe, to make "more" explicit (too much, onestly...)
> from operator import xor as bitwise_xor
> def logical_xor(a, b):
> return bitwise_xor(bool(a), bool(b))
I'd prefer bool(a)!=bool(b)
or even bool(a) is not bool(b)
More information about the Python-list