( __new__ , __init__ . , , , , , __init__, , __new__.)
>>> class Foo(object):
... def __new__(cls, x):
... return super(Foo, cls).__new__(cls)
...
... def __init__(self, x, y):
... pass
>>> Foo(1)
Traceback (most recent call last):
File "<pyshell#260>", line 1, in <module>
Foo(1)
TypeError: __init__() takes exactly 3 arguments (2 given)
>>> Foo(1, 2)
Traceback (most recent call last):
File "<pyshell#261>", line 1, in <module>
Foo(1, 2)
TypeError: __new__() takes exactly 2 arguments (3 given)