Author Tapani Kiiskinen
Recipients Tapani Kiiskinen, docs@python
Date 2015-03-15.19:40:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426448451.56.0.492486239807.issue23674@psf.upfronthosting.co.za>
In-reply-to
Content
https://docs.python.org/3/library/functions.html#super

There's no mention in the document which __mro__ is used in the case of a super(Type, obj) call. There's this mention 'The __mro__ attribute of the *type* lists the method resolution search order used by both getattr() and super().' but my understanding is that this only applies in the case of a super(type) call plus it doesn't state that it only applies in that case. (I'm fairly certain I'm not wrong; if only the __mro__ of the type was used then cooperative multiple inheritance (which is referenced three paragraphs down) could not work because the __mro__ of the type never has sibling types.)

Isn't this misleading due to a super(Type, obj) call (or just super() inside a class in 3k) being the more normal way to use the function? Even now I can't find a single resource to confirm which exact mro is used in the case of a super(Type, obj) call, I've only been able to deduce that it probably uses the type(obj).__mro__ then finds the Type and then tries the entries after Type.

Finally 'If the second argument is omitted, the super object returned is unbound. If the second argument is an object, isinstance(obj, type) must be true. If the second argument is a type, issubclass(type2, type) must be true (this is useful for classmethods).'

I'm interpreting this is essentially saying that if the second argument is given that the returned object will be bound, given an object the super call would return a bound instance method and given a type a bound class method? I feel like stating this explicitly would be more clear than implicitly.
History
Date User Action Args
2015-03-15 19:40:51Tapani Kiiskinensetrecipients: + Tapani Kiiskinen, docs@python
2015-03-15 19:40:51Tapani Kiiskinensetmessageid: <1426448451.56.0.492486239807.issue23674@psf.upfronthosting.co.za>
2015-03-15 19:40:51Tapani Kiiskinenlinkissue23674 messages
2015-03-15 19:40:51Tapani Kiiskinencreate