Why no list as dict key?

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Wed Apr 20 22:48:37 EDT 2022


On 2022-04-21 at 06:22:53 +0400,
Abdur-Rahmaan Janhangeer <arj.python at gmail.com> wrote:

> Maybe hashes should point to an object rather than being the hash of an
> object themselves.
> Maybe the speed drop is not worth it.

Then you have a different problem.

    x = [1, 2, 3]
    y = [n for n in 1, 2, 3]

Those two lists (x and y) are separate but equal objects.  Being
separate, pointers to them would not be equal.  Being equal, they have
to have the same hash.


More information about the Python-list mailing list