Steven D'Aprano <[email protected]> added the comment:
Here's a possibly simpler version which nevertheless still shows multiple calls
to __eq__ (in this case, only 6, not 13):
class C(object):
def __eq__(self, other):
print('eq')
return super().__eq__(other)
def __hash__(self):
return -2
d = {-2, C()}
which outputs:
eq
eq
eq
eq
eq
eq
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38105>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com