TypeError: this constructor takes no arguments

Peter Otten __peter__ at web.de
Fri Jul 2 10:40:15 CEST 2004


Manoj wrote:

> 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

Please make sure you post the actual code. Your snippet fails with a
NameError:

Traceback (most recent call last):
  File "class.py", line 19, in ?
    my = myclass("Paul", "John")
NameError: name 'myclass' is not defined

and indeed you defined 'person', not 'myclass'.

Peter





More information about the Python-list mailing list