[issue26614] False/0 and True/1 collision when used as dict keys?

STINNER Victor report at bugs.python.org
Thu Mar 24 08:47:51 EDT 2016


STINNER Victor added the comment:

Many values have the same hash value, it's not an issue. The hash is only a best effort function to reduce hash collision, but hash collision is well handled in the dict type (as explained in other messages).

>>> hash(1) == hash(1.0) == hash(1.0+0j) == 1
True
>>> hash('') == hash(b'') == hash(0) == hash(0.0) == hash(0.0j) == 0
True

----------
nosy: +haypo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26614>
_______________________________________


More information about the Python-bugs-list mailing list