On 7/26/20 1:47 PM, Marco Sulla wrote: > On Sun, 26 Jul 2020 at 19:33, Henry Lin <hlin...@gmail.com > <mailto:hlin...@gmail.com>> 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.
-- Richard Damon _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/T5DLPPPMWLGYAYNZ7LXG2IZJJWD5RWF6/ Code of Conduct: http://python.org/psf/codeofconduct/