[issue23674] super() documentation isn't very clear

2015-03-16 Thread Tapani Kiiskinen

Tapani Kiiskinen added the comment:

A link to the to the glossary would also be good yes. I was figuring out how 
super() works and as you said the doc gave the impression getattr would explain 
more but it doesn't. Had to use google to find the glossary entry for MRO which 
had the link explaining how that is calculated.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23674] super() documentation isn't very clear

2015-03-15 Thread Tapani Kiiskinen

New submission from Tapani Kiiskinen:

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.

--
assignee: docs@python
components: Documentation
messages: 238157
nosy: Tapani Kiiskinen, docs@python
priority: normal
severity: normal
status: open
title: super() documentation isn't very clear
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com