OOP: method overriding works in mysterious ways?

John M. Gabriele john_sips_teaz at yahooz.com
Mon Jan 2 18:14:10 EST 2006


Dustan wrote:
> [snip] That is, Parent does have its
> own critique method, not a reference to Grand_parent.critique().

Interesting. "It has its own" critique method? Hm. Not quite sure what 
that means exactly...

Anyhow, I wasn't suggesting that Parent had a reference to 
Grand_parent.critique(), only that Python would search *up* the tree 
looking for the method it's looking to call.

Thanks!

> So
> when Child calls self.advise, it is calling its inherrited copy. Then,
> since the inherited Child.advise() from Parent.advise() calls
> self.critique, it calls it's own overriden critique method.
> 
> I hope this makes sense.
> 


-- 
(remove zeez if demunging email address)



More information about the Python-list mailing list