Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Revisions

1 of 2
SilentGhost
  • 322.3k
  • 67
  • 312
  • 294

there is a good part in docs:

Return a proxy object that delegates method calls to a parent or sibling class of type. This is useful for accessing inherited methods that have been overridden in a class.

As well as:

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 closely parallels the use of super in other programming languages.

The second use case is to support cooperative multiple inheritance in a dynamic execution environment. This use case is unique to Python and is not found in statically compiled languages or languages that only support single inheritance. This makes it possible to implement "diamond diagrams" where multiple base classes implement the same method. Good design dictates that this method have the same calling signature in every case (because the order of calls is determined at runtime, because that order adapts to changes in the class hierarchy, and because that order can include sibling classes that are unknown prior to runtime).

SilentGhost
  • 322.3k
  • 67
  • 312
  • 294

AltStyle によって変換されたページ (->オリジナル) /