What is happning over here?Does python Override
<p><strong>Case 1:</strong></p>

<pre><code>class A(object):
    def __init__(self):
        print "A"
class B(A):
   pass
c = b()
#output:
#A
</code></pre>

<p><strong>Case 2:</strong></p>

<pre><code>class A(object):
    def __init__(self):
        print "A"
class B(A):
   def __init__(self):
       print "B"
c = b()
#output:
#B
</code></pre>

<p>In case1 it runs the constructor of <code>class A</code> and in case2 it runs the constructor of <code>class B</code>.</p>

<p>So if case1 prints A is understood that it is running the <code>class A</code> constructor because <code>class B</code> has inherited it.</p>

<p>Then in case2 it only runs the <code>class B</code> constructor but not <code>class A</code> constructor why is that.</p>

<p>Now what is happening over here. Is python overriding the <code>class A</code> constructor ? Or what is happening 
"I am new to programming."</p>

<p>According to the documentation, when a class is constructed the base class is always remembered. Thus, it will resolve all the dependencies if some attribute is not found, the process works in all base classes. In your case, the class B does not have a init method, so it calls its parent method. In the second example, if want to run the constructor of the base class, you can use the super() function. </p>

python oop constructor