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

Martin Panter report at bugs.python.org
Sat Apr 8 20:16:35 EDT 2017


Martin Panter added the comment:

The magical no-argument call could also be clarified:

8. Define in the main text what happens when you omit the first argument (the subclass) to “super”. At the moment, I think the reader could infer that it is the method’s class, but this is only hinted by reading the comment in the illustration and Raymond’s external web page. The documentation should also clarify how it works, or at least be clear when it is not supported (e.g. one method assigned to multiple classes, functions defined outside a class definition, decorators that re-create the class, “super” renamed).

9. The no-argument call creates an instance bound to the first argument of the method, not an unbound instance. Determining the “self” argument is also magical: it does not seem to work with default arguments, variable positional arguments, nor keyword-only arguments. List comprehensions, generator expressions, etc seem to override it, and the argument is not seen by exec and eval.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23674>
_______________________________________


More information about the docs mailing list