Python rarely does anything automatically. As you say, if you want to call the __init__ superclass, you need to do it yourself, usually by calling super :
class B(A): def __init__(self): print 'B' super(B, self).__init__()
It should be noted that instance attributes, like everything else in Python, are dynamic. __init__ not a constructor, which is __new__ , with which you rarely have to intervene. The object is completely built in time when __init__ is called, but since the attributes of the instance are dynamic, they are usually added by this method, which is special only in that it is called first as soon as the object is created.
Of course, you can create instance attributes in any other method, or even outside the class, just by doing something like myBobj.foo = 'bar' .
source share