Classes, Inheritance - Stupid lazy question
Paul Gresham
gresham at mediavisual.com
Wed Apr 12 04:03:41 EDT 2000
Hi,
This is stupid and lazy of me, I have looked through the docs, but I think
my brain is fried today, I just couldn't see it ... when I have a sub-class
with an overridden function/method how do I call the same function/method in
the parent ?
i.e.
class lazy():
__init__(self, name):
self.name = name
fired(self):
print 'You are fired %s' % self.name
class paul(lazy):
__init__(self, name):
self.name = name # <---- ?????
self.april_pay = 0
fired(self):
print 'Here's a box, collect the things from your desk'
lazy.fired(self) # <--- ??????
The thing I'm just not clear about is the __init__ in my subclass, I want to
do an additional initialisation, without having to the whole init from the
parent class. I think what I am doing is kindof close ... but just want to
know the real way to do this !!
Sorry I've just really lost the plot today!
Thanks guys
Paul
More information about the Python-list
mailing list