Guido van Rossum wrote:

*If* my proposal gets accepted, there will be a blanket rule that no
matter how exotic an type's __eq__ is defined, self.__eq__(self)
(i.e., __eq__ called with the same *object* argument) must return True
if the type's __eq__ is to be considered well-behaved; and Python
containers may assume (for the purpose of optimizing their own
comparison operations) that their elements have a well-behaved __eq__.

I think that so long as "badly defined" objects are explicitly still permitted (with the understanding that they may behave badly in containers), and so long as NANs continue to be "badly behaved" in this sense, then I could live with that. It's really just formalizing the status quo as deliberate policy rather than an accident:

nan == nan will still return False

[nan] == [nan] will still return True.

Purists on both sides will hate it :)



--
Steven
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to