title: How to set the element value of a subscriptable attribute of a proxy object
body: <p>I used this <a href="https://stackoverflow.com/questions/26499548/accessing-an-attribute-of-a-multiprocessing-proxy-of-a-class">stackoverflow question</a> to try to implement a <code>manager</code> object that would manage the writing of attributes of a custom object. I know that I need to expose the magic methods like <code>__getattribute__</code>, <code>__setattr__</code>, and <code>__delattr__</code> by defining <code>_exposed_</code> in my proxy class. However, when I try to set the value of an element of a subscriptable attribute of the custom object, it remains unchanged.</p>
  
  <p>Viewing the <code>multiprocessing</code> documentation, I can't find the <code>multiprocessing.managers</code> subclass <code>NamespaceProxy</code>—mentioned in the aforementioned post—anywhere. I am able to import it on one hand; however, I have a nagging doubt that it isn't being implemented correctly.</p>
  
  <p>Here is how I've tried to change the value of an element of an array, attributed to an object of a custom class:</p>
  
  <pre><code>from multiprocessing.managers import BaseManager, NamespaceProxy
  import numpy as np
  
  class TestClass(object):
     def __init__(self, a):
         '''
         Args:
             a (np.ndarray): the array that needs to be changed  
         '''
         self.a = a
  
  class TestProxy(NamespaceProxy):
      # exposes the magic methods for TestProxy objects needed for setting their attributes
      _exposed_ = ('__getattribute__', '__setattr__', '__delattr__')
  
  class MyManager(BaseManager):
      pass
  
  if __name__ == '__main__':
      MyManager.register('test', TestClass, TestProxy)
      manager = MyManager()
      manager.start()
  
      arr = np.array([0,0,0,0])
      managed_obj = manager.test(arr)
      managed_obj.a[0] = 1
  
      print(managed_obj.a)
  
  # Console: [0 0 0 0]
  
  # Expected ouput: [1 0 0 0]
  </code></pre>
  
  <p><strong>Edit:</strong> I was able to change the actual value of <code>a</code> with something like</p>
  
  <pre><code>arr2 = np.array([0])
  managed_obj.a = arr2
  print(managed_obj.a)
  
  # Console : [0]
  </code></pre>
  
  <p>However, I still don't know how to change the value of an element of <code>a</code>.</p>