Should one always add super().__init__() to the __init__?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Sep 30 05:34:17 EDT 2012


On Sun, 30 Sep 2012 00:08:03 -0600, Ian Kelly wrote:

> On Sat, Sep 29, 2012 at 10:40 PM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> On Sat, 29 Sep 2012 17:51:29 -0400, Piet van Oostrum wrote:
>>
>>> It is not necesarily calling the parent class. It calls the
>>> initializer of the next class in the MRO order and what class that is
>>> depends on the actual multiple inheritance structure it is used in,
>>> which can depend on subclasses that you don't know yet. This makes it
>>> even worse.
>>
>> I don't quite follow you here. It sounds like you are saying that if
>> you have these classes:
>>
>> # pre-existing classes
>> class A(object): pass
>> class B(object): pass
>>
>> # your class
>> class C(A, B): pass
>>
>> and somebody subclasses A or B, the MRO of C will change. That is not
>> actually the case as far as I can see.
> 
> The MRO of C will not change, but the class that follows C may be
> different in the MRO of a subclass.

To quote a famous line from the movie Cool Hand Luke, "what we have here, 
is a failure to communicate."

What do you mean by one class following another? Which class is it that 
follows C? What subclass are you talking about, and what is it 
subclassing?

I have absolutely no idea what you are trying to get across here, why you 
think it is important, or whether it matches what Piet is trying to say.



-- 
Steven



More information about the Python-list mailing list