Suppose I write a class, but don\'t define a __hash__
for it. Then __hash__(self)
defaults to id(self)
(self
\'s memory addres
When an object is stored in a dictionary, the __hash__
is used to determine the original bin that the object is placed in. However, that doesn't mean one object will get confused with another in the dictionary- they still check for object equality. It just means that the dictionary will be a bit slower in hashing that type of object than others.