-
Book Overview & Buying
-
Table Of Contents
Python Illustrated
By :
Now that we understand classes, this chapter is going to be a treat.

Python is about to get even cooler. So far, we’ve been building our classes from scratch. We created them, added constructors, attributes, and wrote methods... That is already pretty impressive. But what if I told you there’s a way to reuse what we have already built, tweak it just a bit, and avoid writing the same thing over and over again?

That’s where inheritance comes in. Inheritance is about how to take an existing class and extend it. We’ll learn how to create new classes based on existing ones. This keeps our code clean and reusable, and we avoid duplicate code by reusing classes. And we can do it all while making room for even more animal friends.