+ 1

Whenever i am defining a class and creating an instance of it ,, a TypeError is generated . why so ?

21st Dec 2016, 12:29 PM
Aashna
3 Réponses
+ 2
Try to change the name of your class, because python already define a type "complex" as the int, long, float, ...
21st Dec 2016, 1:05 PM
visph
visph - avatar
+ 1
Please provide sample of the code you used to create class and instance of it.
21st Dec 2016, 12:35 PM
Majstor_Gile
Majstor_Gile - avatar
0
class complex: def __init__(self,real,imag): self.r=real self.i=imag x=complex(3,-4.5) TypeError : this constructor takes no arguments
21st Dec 2016, 12:38 PM
Aashna