weird dict problem, how can this even happen?

Duncan Booth duncan.booth at invalid.invalid
Tue Dec 16 05:10:24 EST 2008


Joel Hedlund <joel.hedlund at gmail.com> wrote:

> I should probably do this with lists instead because I can't really 
> think of a way of salvaging this. Am i right?
> 

I think you probably are correct. The only thing I can think that might 
help is if you can catch all the situations where changes to the dependent 
values might change the hash and wrap them up: before changing the hash pop 
the item out of the dict, then reinsert it after the change.

Alternatively give up on defining hash and __eq__ for FragmentInfo and rely 
on object identity instead.

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list