Why no list as dict key?
Abdur-Rahmaan Janhangeer
arj.python at gmail.com
Wed Apr 20 23:21:57 EDT 2022
Assumes checking for object equality before inserting.
If they are they same, do we need different hashes?
Kind Regards,
Abdur-Rahmaan Janhangeer
about <https://compileralchemy.github.io/> | blog
<https://www.pythonkitchen.com>
github <https://github.com/Abdur-RahmaanJ>
Mauritius
On Thu, Apr 21, 2022 at 7:15 AM <2QdxY4RzWzUUiLuE at potatochowder.com> wrote:
> 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.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list