[Tutor] Inheritance Question [calling a superclass's constructor]

Joel Ricker joejava@dragoncat.net
Sun, 24 Feb 2002 22:55:47 -0500


From: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>

> > class POP3Search(poplib.POP3):
> >     """Create a connection to a POP3 mailserver and search for
messages"""
> >
> >     def __init__(self, host = "", port = 110):
> >         poplib.POP3(host, port)
>
> Ah!  I see that you're trying to call the constructor of the superclass.
> Try:
>
> ###
> def __init__(self, host = "", port = 110):
>     poplib.POP3.__init__(self, host, port)
> ###

Aha. See that now.  Wow, everyone jumped on that one in a hurry :)

Thanks again,
Joel