missing 'xor' Boolean operator

Terry Reedy tjreedy at udel.edu
Mon Jul 27 08:05:55 CEST 2009

greg wrote:
> Terry Reedy wrote:
>> In Math and Python, a<b<c means a<b and b<c, not (a<b)<c or a<(b<c).
>> != is a comparison operator like <,
> Although Python extends the chaining principle to
> !=, this is somewhat questionable, because
> a < b and b < c implies a < c, but a != b and
> b != c does not imply a != c.
> I'm not sure I've ever seen a mathematician
> write a != b != c, but if I did, I would tend
> to think he meant to say that none of a, b,
> c are equal to any other. That's not what it
> means in Python, though.

However, == is transitive, and a == b == c is quite common.
It would hardly do to have different rules for !=.

Either we have a uniform rule for a compare_op b compare_ob c, as we do, 
or we have several fussy rules that would be hard to remember.

More information about the Python-list mailing list