[Python-ideas] documentation for python3 super()
Guido van Rossum
gvanrossum at gmail.com
Sat Jul 2 13:58:30 EDT 2016
No, super() does not (directly) call multiple functions. The function it
calls has to call the next with another super() call. Also, __init__() is
not special, nor is **kwds.
super() itself is special, it knows the class and instance.
There are conventions around all of this though. It may be worth
documenting those, as long as it is made clear which part of the docs is
about conventions (as opposed to how things work).
There are also opinions about those conventions. Here I am not so sure that
they belong in the docs.
--Guido (mobile)
On Jul 2, 2016 10:32 AM, "Barry Scott" <barry at barrys-emacs.org> wrote:
> I have read the python3.5 docs for super() and
> https://rhettinger.wordpress.com/2011/05/26/super-considered-super/.
>
> Between the two sources I still have no clear idea of what super() will
> do and why it will doe what it does.
>
> I hope to get feedback that can be used as the basis to update the python
> docs.
>
> For single inheritance the use of super() does not seem to have any
> surprises.
>
> But in the case of a class with multiple-inheritance more then 1 function
> may be called by 1 call to super().
>
> What are the rules for which functions are called by super() in the
> multiple
> inheritance case?
>
> Is __init__ special or can other super() calls end up
> calling more then 1 function?
>
> What is the role of **kwds with super()?
>
> Here is the code I used to show the __init__ multiple calls.
>
> The attached example shows that one call to super() causes 2 to
> __init__ of bases of Person. But describe does not follow the pattern
> Age.describe is not called.
>
> Barry
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160702/6755de7a/attachment.html>
More information about the Python-ideas
mailing list