Am 13.05.2015 um 15:25 schrieb andrew cooke:
class Foo:
... def __new__(cls, *args, **kargs):
... print('new', args, kargs)
... super().__new__(cls, *args, **kargs)
new (1,) {}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in __new__
TypeError: object() takes no parameters
object's __new__() dosn't take any parameters. So call it without arguments:
class Foo:
def __new__(cls, *args, **kargs):
print('new', args, kargs)
super().__new__(cls)
(at least if we know that we inherit from object. Might be that this one
doesn't work very good with multiple inheritance...)
Thomas
--
https://mail.python.org/mailman/listinfo/python-list