Jan Eden wrote:
> Hi,
> 
> I just noticed that in the following environment:
> 
> class Base:
>     def __init__(self):
>         ...
> 
> class Child(Base):
>     pass
>     
> the following statement:
> 
> child = Child()
> 
> would automatically execute the superclass __init__ method. This is exactly 
> what I was looking for - but in the Cookbook, I found several suggestions on 
> how to actively force the invocation of the superclass __init__.
> 
> Is this behvaiour documented?

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?

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to