June 2019
Beginner to intermediate
770 pages
19h 24m
English
As noted earlier in the Liskov Substitution Principle section, there are two general ways to add features to a class definition:
In general, these choices are always present. Every object-oriented design decision involves choosing between inheritance and composition.
To make the decision more nuanced, Python allows multiple inheritance. While combining multiple mixing classes is partially a kind of inheritance, it is more fundamentally an exercise in composition.
The LSP can lead to avoiding inheritance in favor of composition. The general suggestion is to reserve inheritance ...
Read now
Unlock full access