[New-bugs-announce] [issue14898] Dict collision on boolean and integer values

Sasha B report at bugs.python.org
Thu May 24 12:38:30 CEST 2012


New submission from Sasha B <sbermeister at gmail.com>:

Not sure if this is predicted behaviour, but if I make a dict like:

>>> x = {0: 'bar', True: 'foo'}

and modify True with 1, or 0 with False:
>>> x[False] = 'boo'
>>> x[1] = 'far'

the modifications happen:
>>> x
{0: 'boo', True: 'far'}

Is this expected behaviour? It seems that the hashes for 'False' and 0 are confused, as are the hashes for 'True' and 1.

----------
messages: 161497
nosy: sbermeister
priority: normal
severity: normal
status: open
title: Dict collision on boolean and integer values

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


More information about the New-bugs-announce mailing list