[Python-ideas] NAN handling in the statistics module
David Mertz
mertz at gnosis.cx
Sun Jan 6 23:27:46 EST 2019
This statement is certainly false:
>
> * If two items are equal, and pairwise inequality is deterministic,
> exchanging the items does not affect the sorting of other items in the list.
>
Just to demonstrate this obviousness:
>>> sorted([9, 9, 9, b, 1, 2, 3, a])
[1, 2, 3, A, B, 9, 9, 9]
>>> sorted([9, 9, 9, a, 1, 2, 3, b])
[B, 9, 9, 9, A, 1, 2, 3]
>>> a == b
True
The classes involved are:
class A:
def __lt__(self, other):
return False
__gt__ = __lt__
def __eq__(self, other):
return True
def __repr__(self):
return self.__class__.__name__
class B(A):
def __lt__(self, other):
return True
__gt__ = __lt__
I do not think these are useful, but __lt__ is deterministic here.
--
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons. Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190106/093a6b54/attachment.html>
More information about the Python-ideas
mailing list