title: How to use a multiprocessing.Manager()?
body: <p>I have a concern about <code>multiprocessing.Manager()</code> in python. Here is the example:</p>
  <pre><code>import multiprocessing
  
  def f(ns):
      ns.x *=10
      ns.y *= 10
  
  if __name__ == '__main__':
      manager = multiprocessing.Manager()
      ns = manager.Namespace()
      ns.x = 1
      ns.y = 2
  
      print 'before', ns
      p = multiprocessing.Process(target=f, args=(ns,))
      p.start()
      p.join()
      print 'after', ns
  </code></pre>
  <p>and the output is:</p>
  <pre><code>before Namespace(x=1, y=2)
  after Namespace(x=10, y=20)
  </code></pre>
  <p>Until now, it worked as I expected, then I modified the code like this:</p>
  <pre><code>import multiprocessing
  
  def f(ns):
      ns.x.append(10)
      ns.y.append(10)
  
  if __name__ == '__main__':
      manager = multiprocessing.Manager()
      ns = manager.Namespace()
      ns.x = []
      ns.y = []
  
      print 'before', ns
      p = multiprocessing.Process(target=f, args=(ns,))
      p.start()
      p.join()
      print 'after', ns
  </code></pre>
  <p>Now the output is:</p>
  <pre><code>before Namespace(x=[], y=[])
  after Namespace(x=[], y=[])
  </code></pre>
  <p>It confuses me why the lists were not changed as I expected. Can anyone help me to figure out what happened?</p>