ATHENA
Python for Intermediate Learners / Smart Reader
THE ATHENA LIBRARY

Python for Intermediate Learners

Daniel Haile · textbook

Chapter 6 · Inheritance and super()

Building on what exists

class GraduateStudent(Student): creates a subclass. Calling super().__init__(name) inside its constructor lets the parent initialise shared state before the child adds its own.

Python supports multiple inheritance, resolved through the method resolution order (MRO). Inspecting GraduateStudent.__mro__ shows exactly which class Python will consult first when a method is called.

Mixins — small classes that add one focused capability — are a common, disciplined use of multiple inheritance in real Python codebases.

Fictional educational sample written for the Athena demo · Page 105 of 356.

75%saved