On Thu, 21 Apr 2022 at 13:23, Abdur-Rahmaan Janhangeer
<arj.pyt...@gmail.com> wrote:
>
> Assumes checking for object equality before inserting.
> If they are they same, do we need different hashes?
>

The point of the hash is to find things that are equal. That's why
1234, 1234.0, and 0j+1234.0 all have the same hash.

If equality changes, the hash does too. It's certainly possible to
have the hash come from object identity, but then so must equality. If
you want that, it's easy to do - just create your own object for the
state, rather than using a list. But then you have to use the original
object to look things up, instead of matching by the data.

Hashes are simply a short-hand for equality. That's all.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to