TypeError: this constructor takes no arguments

Manoj sewaonegai at rediffmail.com
Sun Jul 4 22:01:59 EDT 2004


Hello..
I am sorry...i understood the mistake in
my program..
Excuse me.

sewaonegai at rediffmail.com (Manoj) wrote in message news:<325d00dd.0407020033.1fe893b2 at posting.google.com>...
> Hi ,
> I have written a simple program usinga  class.
> But it not compiling.The error i get is 
> my = myclass("Paul", "John")
> TypeError: this constructor takes no arguments
> 
> I checked some previous posting.I have given two underscores
> for the constructor it.
> 
> Any ideas ?
> 
> -----------------------------------------------------
> #class.py
> 
> class person:
>    def __init__(self, lname, fname):
>       self.__lname = lname
>       self.__fname = fname
>    def getFirstname(self):
>       return(self.__fname)
>    def getLastname(self):
>       return(self.__lname)
>    def putFirstname(self, s):
>       self.__fname = s
>    def putLastname(self, s):
>       self.__lname = s
>    __fname = ""
>    __lname = ""
>                                                                                 
> #Here we go
> my = myclass("Paul", "John")
> my.printout("Sample program using CLASS")
> my.printout("written by ")
> p = person()



More information about the Python-list mailing list