On 12/20/2011 7:09 PM, Steven D'Aprano wrote:
Terry Reedy wrote:
2.) there are serious dragons in
how python handles complex inheritance graphs that result in "object.__new__() takes no parameters", despite not having any builtin bases and having no base class overriding __new__ or __init__
Best not to use object as the apex of multiple inheritance.
Is that possible in Python 3?
I believe the recommendation I have seen is something like this
def __init__(self, *arg, **kwds): pass
<__main__.C object at 0x00000000034C0F98>
Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> object(1) TypeError: object.__new__() takes no parameters
Now, so others have posted, define A and B with super, inheriting from C instead of object, and D with super inheriting from A and B, and all should go well instead of crashing. But I have not tested this myself. Same for ordinary single inheritance chain.