logoalt Hacker News

gravel7623yesterday at 8:45 PM1 replyview on HN

I guess because the hash of an instance stays consistent (which is used to retrieve the value from the dict). The `__eq__` method must disregard the hash and return False for all nans.


Replies

munchleryesterday at 8:49 PM

But the hash alone shouldn't be enough to match the key. Isn't an equality check also needed to avoid a false positive? That's the idea behind a hash table, as I understand it. (I'm not a Python programmer.)

show 1 reply