title: Using a global dictionary with threads in Python
body: <p>Is accessing/changing dictionary values thread-safe?</p>
  
  <p>I have a global dictionary <code>foo</code> and multiple threads with ids <code>id1</code>, <code>id2</code>, ... , <code>idn</code>. Is it OK to access and change <code>foo</code>'s values without allocating a lock for it if it's known that each thread will only work with its id-related value, say thread with <code>id1</code> will only work with <code>foo[id1]</code>?</p>