This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: doc search for super().__init__() returns no useful results
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, rhettinger, softwoehr
Priority: normal Keywords:

Created on 2020-09-26 13:03 by softwoehr, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg377527 - (view) Author: Jack W. (softwoehr) Date: 2020-09-26 13:03
It's oddly difficult to glean from the official documentation the correct syntax for superclass initialization.
msg377540 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-09-26 19:46
The __init__() method isn't a feature of super().  It is a feature of the class being called.
msg377542 - (view) Author: Jack W. (softwoehr) Date: 2020-09-26 20:30
True enough, however, no search I could come up which included the term "super" or "__init__" returned a document near the top of the search which showed how to chain a superclass initializer. This can be confusing, as there are 2 syntaxes for doing this.
msg377543 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-09-26 21:01
The primary documentation for super() is here:
https://docs.python.org/3/library/functions.html#super

At the bottom it references a guide to using super() that you might find helpful:
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/

The standard library source code has many examples.  In particular, the argparse module makes heavy use of super():
https://github.com/python/cpython/blob/3.8/Lib/argparse.py

The tutorial provides some light discussion:
https://docs.python.org/3/tutorial/classes.html#multiple-inheritance

There is also an FAQ entry:
https://docs.python.org/3/faq/programming.html#how-do-i-call-a-method-defined-in-a-base-class-from-a-derived-class-that-overrides-it

There is also extensive coverage on StackOverflow:
https://stackoverflow.com/search?q=%5Bpython%5D+super

Hope you find these links helpful.
msg377555 - (view) Author: Jack W. (softwoehr) Date: 2020-09-27 03:55
Thank you.
History
Date User Action Args
2022-04-11 14:59:36adminsetgithub: 86031
2020-09-27 19:08:53rhettingersetstatus: open -> closed
stage: resolved
2020-09-27 03:55:25softwoehrsetresolution: works for me
2020-09-27 03:55:10softwoehrsetmessages: + msg377555
2020-09-26 21:01:42rhettingersetmessages: + msg377543
2020-09-26 20:30:50softwoehrsetmessages: + msg377542
2020-09-26 19:46:23rhettingersetnosy: + rhettinger
messages: + msg377540
2020-09-26 13:03:29softwoehrcreate