File tree 2 files changed +8
-1
lines changed
Filter options
Misc/NEWS.d/next/Core and Builtins
2 files changed +8
-1
lines changed
Original file line number Diff line number Diff line change @@ -1800,6 +1800,13 @@ are always available. They are listed here in alphabetical order.
1800
1800
the second argument is a type, ``issubclass(type2, type) `` must be true (this
1801
1801
is useful for classmethods).
1802
1802
1803
+ When called directly within an ordinary method of a class, both arguments may
1804
+ be omitted ("zero-argument :func: `super `"). In this case, *type * will be the
1805
+ enclosing class, and *obj * will be the first argument of the immediately
1806
+ enclosing function (typically ``self ``). (This means that zero-argument
1807
+ :func: `super ` will not work as expected within a nested function or a generator
1808
+ expression, which implicitly creates a nested function.)
1809
+
1803
1810
There are two typical use cases for *super *. In a class hierarchy with
1804
1811
single inheritance, *super * can be used to refer to parent classes without
1805
1812
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.
1845
1852
:func: `super `, see `guide to using super()
1846
1853
<https://rhettinger.wordpress.com/2011/05/26/super-considered-super/> `_.
1847
1854
1848
-
1849
1855
.. _func-tuple :
1850
1856
.. class :: tuple()
1851
1857
tuple(iterable)
Original file line number Diff line number Diff line change
1
+ Improve :py:class: `super ` error messages.
You can’t perform that action at this time.
0 commit comments