basic inheritance question

Sean 'Shaleh' Perry shalehperry at home.com
Thu Sep 20 16:12:24 EDT 2001


On 20-Sep-2001 Nathan Valentine wrote:
> Thanks to everyone who pointed out that I was not calling the __init__
> of the baseclass.
> 
> BTW, I don't recall seeing any mention of having to do this when
> reading the Python Tutorial authored by Guido. I did another quick
> scan of the doc and still don't see it. Perhaps this is something that
> should be added to the Notes for the section on classes and
> inheritance?

It says this but is not very explicit (last paragraph in the section on
inheritcance).  If you define a method that is also defined in the base class
only the new method is called.  You must call BaseClass.method() to get the base
class's method called.  This applies to __init__ and other __foo__ methods. 
However in a tutoruial this should be more explicit.




More information about the Python-list mailing list