Equality and hashing
By default == on your objects means "the same object", like is. Two
Point(1, 2) objects are not equal. Define __eq__ to compare values.
If other is a different type, return NotImplemented (not False). That
tells Python to try the other side's __eq__ instead.
The surprise: defining __eq__ sets __hash__ to None, so the object can't
go in a set or be a dict key. Python does this because equal objects must
have equal hashes, and the old hash was based on identity.
Fix it with __hash__ that hashes the same fields as a tuple. Only hash
fields that never change: if a key changes after you insert it, the dict
can't find it any more.
Interviewers care because grid and graph problems store positions in a
visited set. Plain tuples like (1, 2) already work.
Run it, then delete __hash__ from Point and watch the dict line fail.