MRAB wrote:
I suppose it depends on the complexity of the data structure. A dict's methods are threadsafe, for example, but if you have a data structure where access leads to multiple method calls then collectively they need a lock.
It also depends on the nature of the objects being used as dict keys. Dict operations invoke the hashing and comparison methods of the keys, which in general can execute arbitrary Python code. If the keys are elementary built-in types such as strings or ints, then dict operations will *probably* be atomic. But I think I'd use a lock anyway, to be on the safe side. -- Greg -- http://mail.python.org/mailman/listinfo/python-list