<div>Hello friends,</div><div><br></div>An instance of my subclass doesn't invoke its superclass method, except when it is referenced<div>directly. </div><div><br></div><div>Here is what I mean:</div><div><br></div><div>
<div>>>> class A(object):</div><div>... def log(self, module):</div><div>... return str('logged')</div><div>...</div><div><br></div><div>>>> class B(A):</div><div>... def __init__(self, module):</div>
<div>... self.module = A().log(module)</div><div>...</div><div>>>> c = B('system')</div><div>>>> # I expect 'logged' to be printed here</div><div>>>> print c.log('system') # why do I have to do this?</div>
<div>>>> 'logged'</div><div><br></div><div><div>Why do I have to make a call to c.log before log() method can be invoked?</div><div><br></div><div>My reasoning is such that since I have passed the log() method to B's constructor, an instance</div>
<div>of B should invoke A's log() method.</div></div><div><br></div><div>What could I be missing in class A or B to have this working as expected?</div>-- <br>Odeyemi 'Kayode O.<br><a href="http://www.sinati.com" target="_blank">http://www.sinati.com</a>. t: @charyorde<br>
<br>
</div>