[Tutor] Class error

Alan Gauld alan.gauld at btinternet.com
Sun Jun 17 20:28:03 CEST 2007

"Henry Dominik" <fiveholiday55 at hotmail.com> wrote

> import AddrBookEntry
> class EmplAddrBookEntry(AddrBookEntry):

This says you are creating a new class that inherits 
from the *module* AddrBookEntry. Notice that the 
error message referred to the module not the class...

You probably meant:

class EmplAddrBookEntry(AddrBookEntry.AddrBookEntry):

>    def __init__(self, nm, ph, id, em):
>        AddrBookEntry.__init__(self, nm, ph)

Which makes this line become
         AddrBookEntry.AddrBookEntry.__init__(self, nm, ph)


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list