On 7/26/20 1:47 PM, Marco Sulla wrote:
On Sun, 26 Jul 2020 at 19:33, Henry Lin <email@example.com mailto:firstname.lastname@example.org> wrote:
* Any class implementing the `__eq__` operator is no longer hashable
You can use:
def __hash__(self): return id(self)
I thought that there was an assumption that if two objects are equal (via __eq__) then their hashes (via __hash__) should be equal? Which wouldn't hold for this definition, and thus dictionaries wouldn't behave as expected.