Sahaj.blogs

Day page

11 Oct 2023

Study

Python · OOP: inheritance and dunder methods

Subclassing with super(), method overriding, and dunder methods (__repr__, __eq__, __len__, __add__) that plug objects into Python syntax.

  • Dunder methods are how your objects plug into Python syntax like len(), ==, + and print.
  • super().__init__(...) lets the parent class do its part of the setup.

Read the post →