OOP: method overriding works in mysterious ways?

Scott David Daniels scott.daniels at acm.org
Mon Jan 2 16:28:41 EST 2006


Dustan wrote:
> .... From my experience, the methods are passed
> down, not referred to from the parent. That is, Parent does have its
> own critique method, not a reference to Grand_parent.critique(). 
This is typical of static binding as (for example) seen in C++.  If you
think of dynamically bound systems like Smalltalk, Ruby, and Python, the
more unusual case is wanting to go up the hierarchy (where you use super
to get the behavior you are apparently expecting).  Think of Python's
method dispatch as always being "virtual".

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list