On Thu, Jan 23, 2020 at 07:29:58PM -0600, Tim Peters wrote:
> PyObject_RichCompareBool(x, y, op) has a (valuable!) shortcut:  if x
> and y are the same object, then equality comparison returns True and
> inequality False.  No attempt is made to execute __eq__ or __ne__
> methods in those cases.
> 
> This has visible consequences all over the place, but they don't
> appear to be documented.


This has definitely been discussed before. Here's one such thread:

https://mail.python.org/pipermail/python-dev/2011-April/110945.html

My recollection is that we reached a consensus that collections in 
general don't have to obey the invariant that `x != x` when x is a NAN. 
But I don't recall seeing it documented outside of the mailing lists. By 
my recollections, this has come up, oh, at least four times now, so 
perhaps there should be a FAQ answering why NAN != NAN except inside 
collections.


-- 
Steven
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/2RGSEKNYWZXI52YZ6RNIEYAXNIWSRHWU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to