[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What's the purpose the hook method showing in a class definition?

On 10/20/19 4:34 AM, jfong at wrote:
> Yes, there will be an attribute error if no goo() was defined. 
> What puzzles me is how a parent's method foo() can find its child's method goo(), no matter it was overwrote or not? MRO won't explain this and I can't find document about it also:-(
> --Jach

The simple answer is that the attribute lookup happens at run time, not
compile time (unlike some other languages). Thus attributes/member
functions can be added by sub-classes, or even just to that instance at
run time and be found.

Richard Damon