[Python-Dev] python and super

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 16 01:38:36 CEST 2011


Michael Foord wrote:

> consider the "recently" introduced problem caused by object.__init__
 > not taking arguments. This makes it impossible to use super correctly
 > in various circumstances.
 >
 > ...
 >
> It is impossible to inherit from both C and A and have all parent 
> __init__ methods called correctly. Changing the semantics of super as 
> described would fix this problem.

I don't see how, because auto-super-calling would eventually
end up trying to call object.__init__ with arguments and fail.

You might think to "fix" this by making a special case of
object.__init__ and refraining from calling it. But the same
problem arises in a more general way whenever some class in
the mix has a method with the right name but the wrong
signature, which is likely to happen if you try to mix
classes that weren't designed to be mixed together.

-- 
Greg


More information about the Python-Dev mailing list