Python class variable dependencies
Question: If have a class that looks something like

    
    
    import numpy as np
    
    class Test(object):
        def __init__(self, args):
            self.x = args[0]
            self.y = args[1]
            self.values = np.array([self.x, self.y])
    

And I want to be able to update both `x` and `values[0]` with a single call

    
    
    a = Test((1., 2.))
    a.x = 2.
    

so that `a.x = 2.` and `a.values[0] = 2.` I am sort of new when it comes to
OOP, so please excuse me if this is obvious.


Answer: You'll need to write a function to do this:

    
    
    def SetX(value):
      self.x = value
      self.values[0] = value
    

