diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index c731b6fd3332753..755e64fb74403ad 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1800,6 +1800,13 @@ are always available. They are listed here in alphabetical order. the second argument is a type, ``issubclass(type2, type)`` must be true (this is useful for classmethods). + When called directly within an ordinary method of a class, both arguments may + be omitted ("zero-argument :func:`super`"). In this case, *type* will be the + enclosing class, and *obj* will be the first argument of the immediately + enclosing function (typically ``self``). (This means that zero-argument + :func:`super` will not work as expected within a nested function or a generator + expression, which implicitly creates a nested function.) + There are two typical use cases for *super*. In a class hierarchy with single inheritance, *super* can be used to refer to parent classes without naming them explicitly, thus making the code more maintainable. This use @@ -1845,7 +1852,6 @@ are always available. They are listed here in alphabetical order. :func:`super`, see `guide to using super() `_. - .. _func-tuple: .. class:: tuple() tuple(iterable) diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-12-20-08-54-54.gh-issue-113212.62AUlw.rst b/Misc/NEWS.d/next/Core and Builtins/2023-12-20-08-54-54.gh-issue-113212.62AUlw.rst new file mode 100644 index 000000000000000..6edbc9c60d968c4 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-12-20-08-54-54.gh-issue-113212.62AUlw.rst @@ -0,0 +1 @@ +Improve :py:class:`super` error messages.