title: Changing values of list in multiprocessing
body: <p>I am new to python multiprocessing, a background about the below code. I am trying to create three processes, one to add an element to the list, one to modify element in the list, and one to print the list.</p>
  <p>The three processes are ideally using the same list that is in shared memory, initiated using <code>manager</code>.</p>
  <p>The problem I face is that <code>testprocess2</code> is not able to set the value to <code>0</code>, basically, it is not able to alter the list.</p>
  <pre><code>class Trade:
      def __init__(self, id):
          self.exchange = None
          self.order_id = id
  
  
  class testprocess2(Process):
      def __init__(self, trades, lock):
          super().__init__(args=(trades, lock))
          self.trades = trades
          self.lock = lock
  
      def run(self):
          while True:
              # lock.acquire()
              print(&quot;Altering&quot;)
              for idx in range(len(self.trades)):
                  self.trades[idx].order_id = 0
              # lock.release()
              sleep(1)
  
  
  class testprocess1(Process):
      def __init__(self, trades, lock):
          super().__init__(args=(trades, lock))
          self.trades = trades
          self.lock = lock
  
      def run(self):
          while True:
              print(&quot;start&quot;)
              for idx in range(len(self.trades)):
                  print(self.trades[idx].order_id)
  
              sleep(1)
  
  
  class testprocess(Process):
      def __init__(self, trades, lock):
          super().__init__(args=(trades, lock))
          self.trades = trades
          self.lock = lock
  
      def run(self):
          while True:
              # lock.acquire()
              n = random.randint(0, 9)
              print(&quot;adding random {}&quot;.format(n))
              self.trades.append(Trade(n))
              # lock.release()
              # print(trades)
              sleep(5)
  
  
  if __name__ == &quot;__main__&quot;:
  
      with Manager() as manager:
          records = manager.list([Trade(5)])
          lock = Lock()
  
          p1 = testprocess(records, lock)
          p1.start()
  
          p2 = testprocess1(records, lock)
          p2.start()
  
          p3 = testprocess2(records, lock)
          p3.start()
  
          p1.join()
          p2.join()
          p3.join()
  </code></pre>