title: Dynamically update attributes of an object that depend on the state of other attributes of same object
body: <p>Say I have an class that looks like this:</p>
  
  <pre><code>class Test(object):
     def __init__(self, a, b):
        self.a = a
        self.b = b
        self.c = self.a + self.b 
  </code></pre>
  
  <p>I would like the value of <code>self.c</code> to change whenever the value of attributes <code>self.a</code> or <code>self.b</code> changes for the same instance.</p>
  
  <p>e.g. </p>
  
  <pre><code>test1 = Test(2,4)
  print test1.c # prints 6
  
  test1.a = 3
  print test1.c # prints = 6 
  </code></pre>
  
  <p>I know why it would still print 6, but is there a mechanism I could use to fire an update to <code>self.c</code> when <code>self.a</code> has changed. Or the only option I have is to have a method that returns me the value of <code>self.c</code> based on the current state of <code>self.a</code> and <code>self.b</code></p>