Function Details: super
Description
Returns a proxy object that delegates method calls to a parent or sibling class of type.
Extended Description
The super() function returns a proxy object that allows you to refer to the superclass implicitly. It's commonly used in class inheritance to call methods from a parent or sibling class. When called without arguments, it returns an unbound super object. When called with two arguments, it returns a bound super object; the type parameter should be a subclass of object_or_type. The most common use is in the __init__ method of a subclass to call the __init__ method of the superclass.
Read More about super from Python Documentation
Function Signature
super([type[, object_or_type]]) -> super
Module: builtins
Class: super
Parameters
Parameter List
- type: Optional[type]
- object_or_type: Optional[Union[object, type]]
Return
Returns a proxy object that delegates method calls to a parent or sibling class.
Return Type
super
Output
Explanation
This example shows how to use super() to call methods from a parent class in a subclass.