On this page
  1. super
  2. Import & Availability
  3. Overview & Signature
  4. Usage
  5. Gotchas
  6. REPL Inspect

super

Prev: sum | Up: __builtins__ | Next: tuple
Rel: classmethod, property, staticmethod, Python Object, MRO & Initialization Dunder Flow, Object-Oriented Programming (OOP)
Ref: docs.python.org — super
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import super

Overview & Signature

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

Usage

class Base:
    def greet(self) -> str: return "hello"

class Loud(Base):
    def greet(self) -> str: return super().greet().upper()

assert Loud().greet() == "HELLO"

Gotchas

REPL Inspect

help(super)

Linked from

Related notes