Exercise 46

Inheritance and Advanced OOP

An important concept that you have to understand is the difference between a class and an object. The problem is, there is no real “difference” between a class and an object. They are actually the same thing at different points in time. I will demonstrate by a Zen koan:

1   What is the difference between a fish and a salmon?

Did that question sort of confuse you? Really sit down and think about it for a minute. I mean, a fish and a salmon are different, but, wait, they are the same thing, right? A salmon is a kind of fish, so I mean it’s not different. But at the same time, a salmon is a particular type of fish, so it’s actually different from all other fish. That’s what makes ...

Get Learn Python the Hard Way: A Deceptively Simple Introduction to the Terrifyingly Beautiful World of Computers and Data Science, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.