By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,587 Members | 1,734 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,587 IT Pros & Developers. It's quick & easy.

Re: Dictionary membership check failure

P: n/a
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 <za****@gmail.comwrote:

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
Nov 5 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.