Dictionary membership check failure

Zac Burns zac256 at gmail.com
Wed Nov 5 20:51:58 CET 2008

Sorry everyone, I found the bug in my code shortly after posting here.

For the curious:

I was using a QString (pyqt) inadvertently in the lookup. I guess the
behavior then would be would be that QStrings hash differently than
strings which accounts for the membership check failure, but lists do
an equivalency check of some sort (I don't know the C code, this is an
educated guess) without ever hashing so it succeeded.

Zachary Burns
Aim - Zac256FL
Production Engineer
Zindagi Games

On Wed, Nov 5, 2008 at 11:34 AM, Zac Burns <zac256 at gmail.com> wrote:
> Greetings,
> I have a dictionary that seems to be misbehaving on a membership
> check. This test code:
> 1: import types
> 2: assert myDict.__class__ is types.DictionaryType
> 3: assert (key in myDict.keys()) == (key in myDict)
> raises AssertionError on line three. The dictionary items are all of
> type (string, function).
> There are no threads.
> Python version is 2.5.1, I cannot go to 2.5.2 right now because of a
> module that we use that depends on 2.5.1 (maya standalone), but does
> anyone know if this bug has been fixed in 2.5.2 or if I can give
> anyone more information to help fix this bug?
> --
> Zachary Burns
> Aim - Zac256FL
> Production Engineer
> Zindagi Games

More information about the Python-list mailing list