extending inherited function
Robert Kern
kernr at mail.ncifcrf.gov
Fri Sep 3 01:17:42 EDT 1999
On Thu, 02 Sep 1999 19:53:28 -0700, Andy Beall <beall at psych.ucsb.edu>
wrote:
>I'm using class inheritance and both my base and derived classes define
>an __init__ function. But it appears that the derived class overwrites
>the __init__ function of the base class. Is there a way to extend the
>base class function without overwriting, or just have both __init__
>functions called?
Usually you do something like this:
class Base:
def __init__(self, arg):
do_something()
class Derived(Base):
def __init__(self, arg):
Base.__init__(self, arg)
do_other_thing()
>Thanks,
>Andy-
Robert Kern |
----------------------|"In the fields of Hell where the grass grows high
This space | Are the graves of dreams allowed to die."
intentionally | - Richard Harter
left blank. |
More information about the Python-list
mailing list