title: How do I append a Python object attribute (list)
body: <p>I would like to write a function to append an attribute of a Python object, the attribute is a list.</p>
  
  <p>Here is my code, which sets the attribute to a given value. Is there a simpler/cleaner way to this..</p>
  
  <pre><code>class Obj(object):
      def __init__(self):
          self.a = 2
          self.b = []
          self.c = []
  
      def append_att(self, att):
          at = getattr(self, att)
          at.append(self.a)
          setattr(self,att, at)
  obj = Obj()
  obj.append_att('b')
  obj.append_att('b')
  print obj.b
  </code></pre>