On 7/8/2014 8:10 PM, Steven D'Aprano wrote:
There's no force of law that requires Python to enforce reflexivity on
values where reflexivity does not apply,
There are laws of logic that make the lack of reflexivity obnoxious when
putting objects in collections. Python evaded the problem, at least for
some builtins, by contradicting itself and treating nans as equal to
themselves in the context of collections.
In 2.x, 'in' was defined in terms of ==, but
>>> nan=float('nan')
>>> nl = [nan]
>>> nan in nl
True
even though nan != the only member of nl.
In 3.x, 'in' was redefined to include 'is' as well as '=='.
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list