[issue45080] functools._HashedSeq implements __hash__ but not __eq__

Serhiy Storchaka report at bugs.python.org
Thu Sep 2 01:50:55 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

1. self.hashvalue == other.hashvalue is not enough. Different tuples can have the same hash value, so you steel need to compare their context.

2. _HashedSeq is only used as a key in a dictionary. When you look up a key in dictionary, it compares hashes first. __eq__ is only called when hashes match.

----------
nosy: +rhettinger, serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45080>
_______________________________________


More information about the Python-bugs-list mailing list