3 ms·
> If hash(x) == hash(y), then some_dict[x] and some_dict[y] will return the same value This was my first thought too, so I checked but >>> hash(0) 0 >>> ha
by shpx 11y ago
> If hash(x) == hash(y), then some_dict[x] and some_dict[y] will return the same value
This was my first thought too, so I checked but
>>> hash(0)
0
>>> hash(0.0)
0
>>> hash('')
0
>>> {0: 4}['']
KeyError: ''
Which makes sense, because there is checking for hash collisions, and when they are resolved 0 == 0.0 while 0 != ''