[Tutor] Using superclass __init__ method
lists at janeden.org
Thu Sep 22 16:42:59 CEST 2005
Kent Johnson wrote on 22.09.2005:
>This is standard behavior for any class attribute - if it's not
>defined in the derived class, the base class is checked. It's not
>special for __init__.
>I can't find a comprehensive reference for the way attribute lookup
>works - anyone else?
Well, I did know that any attribute used explicitly with a class instance is looked up in the class, then the base class etc:
variable = 1
child = Child()
What I did not know was that the __init__ method behaves the same way - i.e. that Python looks for __init__ upon instantiation until it finds one.
A good programmer is someone who looks both ways before crossing a one-way street. - Doug Linder
More information about the Tutor