multithreading and shared dictionary

Alex Martelli aleax at mac.com
Fri Jul 7 22:30:51 EDT 2006


Istvan Albert <istvan.albert at gmail.com> 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).


Alex



More information about the Python-list mailing list