Géry <gery.o...@gmail.com> added the comment:

@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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37176>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to