Python Class Inheritance, __init__ and cls
Question: 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...

    
    
    class Player:
      stuff=[]
      def __init__(self):
        cls.stuff.append(self)
    
    class Team(Player):
      def __init__(self):
        super(Team, self).__init__()
    
    b=Team()
    

ERROR

    
    
    cls.stuff.append(self)
    NameError: global name 'cls' is not defined
    

I could pass the cls variable in the `Team.__init__()`, but I'm not sure if
that is the "correct" way, and more importantly the `Player.__init__()` would
need a class variable, and I'm not sure on the syntax on how to do that.


Answer: 
    class Player(object):
        stuff=[]
        def __init__(self):
            self.stuff.append(self)
    
    class Team(Player):
        def __init__(self):
            super(Team, self).__init__()
    
    b = Team()
    print(Team.stuff)
    

prints (something like)

    
    
    [<__main__.Team object at 0xb7519dec>]
    

