constructors in python

eli li elimli at yahoo.com
Sun Apr 21 14:24:36 EDT 2002


But what does happened when I forget (I'm just a man) to call father's c-or?
Semi-initialized object? C++ doesn't permit not to call the base c-or.

"Peter Hansen" <peter at engcorp.com> wrote in message
news:3CC2ED37.3D9225B3 at engcorp.com...
> eli li wrote:
> >
> > Consider, we have two classes: one derived from other. In derived class
c-or
> > how is it possible to call the base c-or? Simple call base.__init__
(...)?
>
> Assuming c-or means constructor:
>
> [untested code]
>
> class Base:
>    def __init__(self):
>        return
>
> class Derived(Base):
>    def __init__(self):
>        Base.__init__(self)
>        return
>
>
> -Peter





More information about the Python-list mailing list