An exercise to help build the right mental model for Python data.
- Solution
- Explanation: "User-defined classes have __eq__() and __hash__() methods by default (inherited from the object class); with them, all objects compare unequal (except with themselves) and x.__hash__() returns an appropriate value such that x == y implies both that x is y and hash(x) == hash(y)."
#Python #memory_graph #Equality #Hashing
That's a very complicated way to explain it though.
It's like putting your friend Sarah on a bike and then giving her Christina's jacket. You haven't changed the fact that Sarah is on the bike and Christina isn't.
save