>>> class A(object): def __init__(self, *args, **kwargs): print('init') print(self) print(args) print(kwargs) def __new__(cls,*args, **kwargs): print('new') print(cls) print(args) print(kwargs) return object.__new__(cls,*args, **kwargs) >>> a = A('123',b='asdf') new <class '__main__.A'> ('123',) {'b': 'asdf'} Traceback (most recent call last): File "<pyshell#27>", line 1, in <module> a = A('123',b='asdf') File "<pyshell#26>", line 12, in __new__ return object.__new__(cls,*args, **kwargs) TypeError: object() takes no parameters
请问老师这里运行到return为什么会报错啊,我该怎么改呢?