title: Python Class Inheritance, __init__ and cls
body: <p>The desired output of the code is that I have a class variable Team.stuff which has one entry holding the b instance, and the Player.stuff variable should be empty.  Instead I get an error...</p>
  
  <pre><code>class Player:
    stuff=[]
    def __init__(self):
      cls.stuff.append(self)
  
  class Team(Player):
    def __init__(self):
      super(Team, self).__init__()
  
  b=Team()
  </code></pre>
  
  <p>ERROR</p>
  
  <pre><code>cls.stuff.append(self)
  NameError: global name 'cls' is not defined
  </code></pre>
  
  <p>I could pass the cls variable in the <code>Team.__init__()</code>, but I'm not sure if that is the "correct" way, and more importantly the <code>Player.__init__()</code> would need a class variable, and I'm not sure on the syntax on how to do that.</p>