You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.
A class that overrides __eq__() and does not define __hash__() will have its __hash__() implicitly set to None. When the __hash__() method of a class is None, instances of the class will raise an appropriate TypeError when a program attempts to retrieve their hash value, and will also be correctly identified as unhashable when checking isinstance(obj, collections.Hashable).
Instead of raising a TypeError from __hash__(), the method should not be present at all, and a __hash__ = None should be in its place, like this:
The implementation to make a class unhashable which has been added in #184 is wrong. See commit daa213d for the changes.
The python data model docs at
https://docs.python.org/3/reference/datamodel.html#object.__hash__ state:
Instead of raising a
TypeError
from__hash__()
, the method should not be present at all, and a__hash__ = None
should be in its place, like this:The text was updated successfully, but these errors were encountered: