Summarize the concept explored in this chapter regarding when objects are alike in Python.

We'll cover the following


Some key points in this chapter:

  • A central object-oriented design principle is inheritance: a subclass can inherit aspects of a superclass, saving copy-and-paste programming. A subclass can extend the superclass to add features or specialize the superclass in other ways.
  • Multiple inheritance is a feature of Python. The most common form is a host class with mixin class definitions. We can combine multiple classes leveraging the method resolution order to handle common features like initialization.
  • Polymorphism lets us create multiple classes that provide alternative implementations for fulfilling a contract. Because of Python’s duck typing rules, any classes that have the right methods can substitute for each other.


We’ve gone from simple inheritance, one of the most useful tools in the object-oriented programmer’s toolbox, all the way through to multiple inheritance – one of the most complicated. Inheritance can be used to add functionality to existing classes and built-in generics. Abstracting similar code into a parent class can help increase maintainability. Methods on parent classes can be called using super, and argument lists must be formatted safely for these calls to work when using multiple inheritance.

Get hands-on with 1200+ tech skills courses.