[Tutor] Inheritance Question
Sheila King
sheila@thinkspot.net
Sun, 24 Feb 2002 19:12:33 -0800
On Sun, 24 Feb 2002 22:02:35 -0500, "Joel Ricker" <joejava@dragoncat.net> wrote about [Tutor]
Inheritance Question:
> Now my understanding is -- and I guess I'm wrong -- is that
> POP3Search will inherit the attributes of POP3 so that getwelcome()
> when run will: Look in the child -- since none found, look in the
> parent -- executes that and returns the result. getwelcome
> returns self.welcome -- self in this case being the parent.
> Since welcome isn't found in the current class (POP3Search),
> find it in the parent (POP3). Any case I'm getting an error that its not being found:
No, your understanding is correct. You just aren't subclassing the
POP3 init correctly.
Try this, instead:
class POP3Search(poplib.POP3):
def __init__(self, host = "", port = 110):
poplib.POP3.__init__(self, host, port)
HTH,
--
Sheila King
http://www.thinkspot.net/sheila/
"When introducing your puppy to an adult cat,
restrain the puppy, not the cat." -- Gwen Bailey,
_The Perfect Puppy: How to Raise a Well-behaved Dog_