A bit weird dictionary behavior

Pekka Laukkanen peke at iki.fi
Mon Sep 22 05:25:58 EDT 2008


Hello,

just noticed this:

Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> {1: 2}
{1: 2}
>>> {True: False}
{True: False}
>>> {1: 2, True: False}
{1: False}

This must be because

>>> True == 1 and True in {1: 2}
True

but it still doesn't feel exactly right. Would it be worth submitting a bug?

Cheers,
    .peke



More information about the Python-list mailing list