Inheritance says a thing is a kind of another thing. Composition says a thing has another thing inside it. A car is not an engine, but it has one. Beginners reach for inheritance because it is the famous feature, yet experienced programmers often prefer composition, because it keeps classes loosely connected and easy to change. This lesson shows both, side by side, and gives you a way to choose.
More lessons in Complete Python Programming