The Real Python Podcast cover image

Selecting Inheritance or Composition in Python

The Real Python Podcast

00:00

When Inheritance Beats Composition

  • Favor composition over inheritance most of the time, but not always; choose based on concrete trade-offs in your problem.
  • Adrian's executor example shows inheritance can be simpler and more robust when reusing a vetted API.
Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app