[issue43896] Update the Sphinx directive for super from function to class
New submission from Géry
**super**([*type*[, *object-or-type*]])
should become
*class* **super**([*type*[, *object-or-type*]])
----------
assignee: docs@python
components: Documentation
messages: 391458
nosy: docs@python, maggyero
priority: normal
severity: normal
status: open
title: Update the Sphinx directive for super from function to class
type: enhancement
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker
Change by Géry
Raymond Hettinger
Raymond Hettinger
Raymond Hettinger
Géry
Looking again, it seems to someone has already started applying class markup despite previous decisions not to do so.
Yes, and he forgot super:
class bool([x])
class bytearray([source[, encoding[, errors]]])
class bytes([source[, encoding[, errors]]])
class complex([real[, imag]])
class dict(**kwarg)
class dict(mapping, **kwarg)
class dict(iterable, **kwarg)
class float([x])
class frozenset([iterable])
class int([x])
class int(x, base=10)
class list([iterable])
class memoryview(obj)
class object
class property(fget=None, fset=None, fdel=None, doc=None)
class range(stop)
class range(start, stop[, step])
class set([iterable])
class slice(stop)
class slice(start, stop[, step])
class str(object='')
class str(object=b'', encoding='utf-8', errors='strict’)
class tuple([iterable])
class type(object)
class type(name, bases, dict, **kwds)
----------
_______________________________________
Python tracker
Raymond Hettinger
Géry
Elsewhere in the docs, all the links to this entry use the markup, :func:`super` which looks nicer in the docs than the class reference.
I was suggesting only to update the block Sphinx directive “.. function::” to “.. class::” for defining the signature (so that the “class” prefix appears before the signature, like for the other built-in types), not the inline Sphinx roles “:func:” to “:class:” (since for instance `int` use both in the page: :class:`int` and :func:`int`).
Also the “class” prefix already appears in the interactive help when typing `help(super)`:
Help on class super in module builtins:
class super(object)
| super() -> same as super(__class__, <first argument>)
| super(type) -> unbound super object
| super(type, obj) -> bound super object; requires isinstance(obj, type)
| super(type, type2) -> bound super object; requires issubclass(type2, type)
| Typical use to call a cooperative superclass method:
| class C(B):
| def meth(self, arg):
| super().meth(arg)
| This works for class methods too:
| class C(B):
| @classmethod
| def cmeth(cls, arg):
| super().cmeth(arg)
----------
_______________________________________
Python tracker
Raymond Hettinger
participants (2)
-
Géry
-
Raymond Hettinger