Dictionaries and Threads

Thomas Wouters thomas at xs4all.net
Sat May 20 11:11:22 EDT 2000

On Sat, May 20, 2000 at 11:02:07AM -0400, Jay Love wrote:

> Are dictionary lookups threadsafe?

> ie, can I lookup and retrieve an item in a dictionary while another
> thread is adding an item?

Python takes great care to make sure all builtin operations are threadsafe,
and tries to make it as easy as possible to make your own extensions
threadsafe. As long as you write Python, you're very threadsafe, because
only one thread can execute Python code. If you start writing extentions, in
C, or embedding Python in a multi-threaded program, things get a little more
complicated, though, and you'll have to pay attention to where you allow
multiple (Python) threads to execute.

Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

More information about the Python-list mailing list