I was playing around with the built-in functions when I came across the hash function. hash function basically returns an integer that is not equal for two different objects as mentioned in the docs. So I tried it with the interactive console and to my surprise the hash values of -1 and -2 are returned same.
If so then how can we use them both in a dictionary as keys (because for a key to be used in dict its hash value must be unique, right)?
>>> hash(-1) == hash(-2)
True
>>> hash(-1)
-2
>>> hash(-2)
-2