One obscure detail of the implementation of list equality:

In Python an object can be unequal to itself:

>>> class A:
...     def __eq__(self, other): return False
... 
>>> a = A()
>>> a == a
False

However, the list assumes that (a is a) implies a == a, so

>>> [a] == [a]
True


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to