Closed gshulegaard closed 6 years ago
I'm confused as to why you'd want a __hash__
method if you have an __eq__
method. The only purpose I can think of is so that you can insert CrossplaneObjects into sets/dicts, but you really shouldn't do that anyway since they're mutable objects.
Here's an exerpt from the Python docs:
If a class defines mutable objects and implements an
__eq__()
method, it should not implement__hash__()
, since the implementation of hashable collections requires that a key’s hash value is immutable (if the object’s hash value changes, it will be in the wrong hash bucket).
https://docs.python.org/3.6/reference/datamodel.html#object.__hash__
We have decided to remove all of this object-oriented stuff before the next version of crossplane is released.
__hash__
and__eq__
operators that use these hashes.