[Python-Dev] python and super
Steven D'Aprano
steve at pearwood.info
Sun Apr 17 03:48:07 CEST 2011
Michael Foord wrote:
> On 15/04/2011 02:23, Steven D'Aprano wrote:
[...]
>> If we treat django's failure to use super as a bug, you want the
>> Python language to work-around that bug so that:
>
> What you say (that this particular circumstance could be treated as a
> bug in django) is true, however 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.
So you say. I don't have an an opinion on whether or not you are
technically correct, but adding DWIM black-magic to super scares me. It
scares me even if it were guaranteed to *only* apply to __init__, but if
it applied to arbitrary methods, it frankly terrifies me.
If it were limited to only apply to __init__, there would be a constant
stream of requests that we loosen the restriction and "make super just
work" for all methods, despite the dangers of DWIM code.
--
Steven
More information about the Python-Dev
mailing list