This seems very confusing to me. Could someone explain why this unknown magical things happening ?
class A(object): def testA(self): print "TestA of A" self.testB() def testB(self): print "TestB of A" class B(A): def testA(self): super(B, self).testA() print "TestA of B" self.testB() def testB(self): print "TestB of B" if __name__ == '__main__': test = B() test.testA() Program Output: =============== TestA of A TestB of B --> Why it is calling derived class method ? TestA of B TestB of B Expected Output: ================ TestA of A TestB of A -- I want to see A here. TestA of B TestB of B
Your answer will be appreciated. Thank You.