[Tutor] Class error

Henry Dominik fiveholiday55 at hotmail.com
Sun Jun 17 20:52:36 CEST 2007


Thanks a million Alan,

Your suggestion helped solve the problem.
Besides, why did I have to do this: class 
EmplAddrBookEntry(AddrBookEntry.AddrBookEntry):

The AddrBookEntry and EmplAddrBookEntry classes are in the same folder, I 
didn't think I needed to call another module or something..

Well, I need to learn more :)

Thanks anyway

--Dom
----- Original Message ----- 
From: "Alan Gauld" <alan.gauld at btinternet.com>
To: <tutor at python.org>
Sent: Sunday, June 17, 2007 7:28 PM
Subject: Re: [Tutor] Class error


>
> "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)
>
> HTH,
>
> -- 
> Alan Gauld
> Author of the Learn to Program web site
> http://www.freenetpages.co.uk/hp/alan.gauld
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list