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 maggyero
Recipients docs@python, jdemeyer, maggyero, martin.panter, rhettinger, steven.daprano
Date 2019-06-08.10:28:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559989734.66.0.564873636961.issue37176@roundup.psfhosted.org>
In-reply-to
Content
@Steven D'Aprano

> But neither can it *only* look at the MRO of the second class, because that would restart the search at the top of the hierarchy; also if type(second argument) was the only thing that mattered, that would make the first argument redundant and pointless.

Yes of course, but nobody states the opposite. Both parameters are necessary super(type1, obj-or-type2):

— the first one for getting the start class in the MRO, which is the class following type1 in the MRO;
— the second one for getting the MRO, which is type(obj).__mro__ if it is an instance of type1 or type2.__mro__ if it is a subclass of type1, and for binding the function into a method in a super(type1, obj).function expression (as you correctly said in your last message).

Guido's Python equivalent implementation of super() given in his 2002 paper Unifying types and classes in Python 2.2 is very informative:
https://www.python.org/download/releases/2.2.3/descrintro/#cooperation

All this confusion around super() shows that there is room for improvement in the documentation.

@Raymond Hettinger

> Please make a concrete proposal (a PR or somesuch).

I will try to make a PR this weekend if I find some time.
History
Date User Action Args
2019-06-08 10:28:54maggyerosetrecipients: + maggyero, rhettinger, steven.daprano, docs@python, martin.panter, jdemeyer
2019-06-08 10:28:54maggyerosetmessageid: <1559989734.66.0.564873636961.issue37176@roundup.psfhosted.org>
2019-06-08 10:28:54maggyerolinkissue37176 messages
2019-06-08 10:28:54maggyerocreate