This is clearly not working properly.
Why is this happening?
>>> d = {0 : "a", 1 : "b", 2 : "c", 3 : "d", True: 99}
>>> print d
{0: 'a', 1: 99, 2: 'c', 3: 'd'}
>>>
This is clearly not working properly.
Why is this happening?
>>> d = {0 : "a", 1 : "b", 2 : "c", 3 : "d", True: 99}
>>> print d
{0: 'a', 1: 99, 2: 'c', 3: 'd'}
>>>
True == 1
. There are reasons to disagree with that design decision, but that's how things are in Python. (Similarly, False == 0
.) You can't have two equal keys in a dict, so you can't have both True
and 1
as keys in the same dict.