I would have hoped this works (in Python 3.6),
class A:
__hash__ = id
A().__hash__()
but I get
TypeError: id() takes exactly one argument (0 given)
Surprisingly,
def my_id(self):
return id(self)
class A:
__hash__ = my_id
A().__hash__()
works as hoped.