This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jdemeyer
Recipients docs@python, jdemeyer, rhettinger, steven.daprano
Date 2019-06-07.13:56:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559915805.1.0.622151012135.issue37176@roundup.psfhosted.org>
In-reply-to
Content
> What matters is the __mro__ attribute of the first argument. It matters 
because that is how the MRO actually is searched.

I'm sorry to say that you're wrong here. super() looks at the MRO of the type of the object (the second argument) (*). It has to do that in order to support diamonds. Consider a diamond like

  D
 / \
B   C
 \ /
  A

(with A as common base class). Now super(B, D()).attr will look in the MRO of D (which is D, B, C, A) and therefore delegate to C.attr. In this case, C does not even appear in the MRO of B.

(*) To be pedantic: in the special case that the second argument is a type itself, it looks at the MRO of the second argument.
History
Date User Action Args
2019-06-07 13:56:45jdemeyersetrecipients: + jdemeyer, rhettinger, steven.daprano, docs@python
2019-06-07 13:56:45jdemeyersetmessageid: <1559915805.1.0.622151012135.issue37176@roundup.psfhosted.org>
2019-06-07 13:56:45jdemeyerlinkissue37176 messages
2019-06-07 13:56:45jdemeyercreate