Christian Heimes added the comment: Additional prints make it easy to understand what happens here:
>>> class Anything: ... def __eq__(self, other): ... print("eq") ... return True ... def __ne__(self, other): ... print("ne") ... return False ... >>> x = lambda: None >>> print(x == Anything()) False >>> print(Anything() == x) eq True >>> y = object() >>> print(y == Anything()) eq True >>> print(Anything() == y) eq True x == Anything() doesn't invoke Anything.__eq__(). It's using function.__eq__(). ---------- nosy: +tiran __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1393> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com