The Silent Hash Override
class Point:
def __init__(self, x, y):
self.x, self.y = x, y
def __eq__(self, other):
return self.x == other.x and self.y == other.y
p = Point(1, 2)
print(p.__hash__)
hash(p)
Point never mentions __hash__. What happens when this code runs?
Sign in to answer questions and track your progress
Sign In