title: append list within classes (python)
body: <p>I've run into a problem with inheritance in python that I know how to avoid, but don't completely understand. The problem occured while making a menu but I've stripped down the code to only the real problem.
  code:</p>
  
  <pre><code>class menu:
      buttonlist=[]
  
  &gt;&gt;&gt; class av(menu):
      def __init__(self, num):
          self.buttonlist.append(num)
          print self.buttonlist
  
  &gt;&gt;&gt; AV=av(12)
  [12]
  &gt;&gt;&gt; class main(menu):
      def __init__(self, num):
          self.buttonlist.append(num)
          print self.buttonlist
  
  &gt;&gt;&gt; Main=main(14)
  [12, 14]
  &gt;&gt;&gt; AV.buttonlist
  [12, 14]
  </code></pre>
  
  <p>I'd expect to get [14] in return by the 'Main=main(14)', and [12] with the 'AV.buttonlist' but instead it seems append has appended the list in all classes and objects :S
  can anyone explain to me why this is?</p>
  
  <p>thanks in advance!</p>