On Sun, Jul 12, 2009 at 10:16 AM, Bjorn Meyer<bjorn.m.me...@gmail.com> wrote: > I am trying to convert a piece of code that I am using the thread module with > to the multiprocessing module. > > The way that I have it set up is a chunk of code reads a text file and assigns > a dictionary key multiple values from the text file. I am using locks to write > the values to the dictionary. > The way that the values are written is as follows: > mydict.setdefault(key, []).append(value) > > The problem that I have run into is that using multiprocessing, the key gets > set, but the values don't get appended.
Don't have much concurrency experience, but have you tried using a defaultdict instead? It's possible its implementation might solve the problem. http://docs.python.org/dev/library/collections.html#collections.defaultdict Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list