Alex Martelli wrote: > Istvan Albert <[EMAIL PROTECTED]> wrote: > > > Stéphane Ninin wrote: > > > > > Is a lock required in such a case ? > > > > I believe that assignment is atomic and would not need a lock. > > Wrong, alas: each assignment *could* cause the dictionary's internal > structures to be reorganized (rehashed) and impact another assignment > (or even 'get'-access).
Oh yeah you are correct, i forgot about possible rehashing after assignment operation, so to that means you do need to use a lock to restrict only one thread at time from accessing the dictionary. Again i recommend using a Queue to do this. If you need help with usage of Queue object first see http://www.google.com/notebook/public/14017391689116447001/BDUsxIgoQkcSO3bQh or contact me -Cheers -- http://mail.python.org/mailman/listinfo/python-list