I want to define a class and create an object instance. But always get error. The code goes like this:
class complex:
def _init_(self,realpart,imagpart):
self.r=realpart
self.i=imagpart
x=complex(3,4)
the error message is:
Traceback (most recent call last):<br>
File "pyshell#5", line 1, in "module" <br>
x=complex(3,4) <br>
TypeError: object.__new__() takes no parameters
so what is the problem?
thanks for your reading!
__init__not_init_3+4jfor example