[issue40343] Programming FAQ about "How do I call a method defined in a base class from a derived class that overrides it?" should mention the no-arguments-version of `super`

Dominik V. report at bugs.python.org
Mon Apr 20 17:15:44 EDT 2020


New submission from Dominik V. <dominik.vilsmeier1123 at gmail.com>:

Right now it contains the following example:

    class Derived(Base):
        def meth(self):
            super(Derived, self).meth()

`super()` without arguments is beneficial for multiple reasons, so it should be used in the example.

Also the paragraph speaks about versions prior 3.0 which seems strange because

1. the page is served at https://docs.python.org/3/faq/programming.html i.e. corresponding to version Python 3
2. Python 2 maintenance has been finally dropped.

The provided example is still useful though, for example in multiple inheritance scenarios (though these are very specific and `super()` of course also works if base classes are compatible). So perhaps it's better left out?

----------
assignee: docs at python
components: Documentation
messages: 366884
nosy: Dominik V., docs at python
priority: normal
severity: normal
status: open
title: Programming FAQ about "How do I call a method defined in a base class from a derived class that overrides it?" should mention the no-arguments-version of `super`
type: enhancement
versions: Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40343>
_______________________________________


More information about the Python-bugs-list mailing list