threads and dictionaries

Peter Hansen peter at engcorp.com
Tue Dec 12 23:30:14 EST 2000


bartig at pinpoint.com wrote:
> 
> I'm writing a program that passes dictionaries into a subroutine that's
> threaded.  Are dictionaries thread safe?  If so how would I go about
> making changes to the dictionaries inside of a thread so that other
> threads can take advantage this?

Following on Aahz's answer: it's not so much a question of whether
*dictionaries* are safe, as it is a question of whether the operation(s)
you intended to perform on a dictionary is (are) safe.  Multiple
operations are of course not safe without proper protection.  In Python
many simple operations on basic data types are safe.  Anything specific
in mind?



More information about the Python-list mailing list