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?

A

Defining __eq__ has no effect on hashing, so both lines behave exactly as if Point had no __eq__ at all

B

p.__hash__ prints None, and hash(p) raises TypeError: unhashable type: 'Point'

C

p.__hash__ prints the inherited object.__hash__ (based on id(p)), and hash(p) succeeds

D

p.__hash__ prints None, but hash(p) still succeeds by falling back to id(p)