title: How to get object attributes to update dynamically in Python
body: <p>I'd like to create a class that has 2 input attributes and 1 output attribute such that whenever one of the input attributes are modified the output attribute is modified automatically</p>
  
  <p>I've tried defining the attributes as instance variables within and outside the constructor function but in either case, after instantiating the object, the output attribute remains fixed at the value set at the moment of instantiation</p>
  
  <pre><code>class Example():
  
      def __init__(self,n):
          self.name=n
  
      inA=1
      inB=1
  
      if inA==1 and inB==1:
          outA=1
      else:
          outA=0
  </code></pre>
  
  <p>when instantiated outA is set to 1 as expected
  but if I try to update:
  object.inA=0</p>
  
  <p>object.outA remains 1 whereas I need it to be updated to 0</p>
  
  <p>Trying to avoid the use of functions if possible. New to python and OOP so sorry if this question is nonsensical or has an obvious answer</p>