TypeError: this constructor takes no arguments

Manoj sewaonegai at rediffmail.com
Fri Jul 2 10:33:51 CEST 2004


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