Antoine Pitrou <pit...@free.fr> added the comment:

> I see the type check of the 'other' object as an operation towards the
> equal comparison, since it validates wether 'self' and 'other' can be
> equal at all. If they are of a different type, then they cannot be
> equal, thus the anwser to "Are 'self' and 'other' equal?" should be
> False. This again, would mean an equal operation is implemented and
> returning NotImplemented is not the right anwser.

The explanation for NotImplemented is that an user-defined class may
decide it can compare equal to a WeakSet (without inheriting from
WeakSet). Returning NotImplemented from WeakSet.__eq__ gives a chance to
the user-defined class' __eq__ method to be called.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5964>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to