Exercise 42. Is-A, Has-A, Objects, and Classes

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 with a Zen koan:

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 it a salmon and not ...

Get Learn Python 3 the Hard Way: A Very Simple Introduction to the Terrifyingly Beautiful World of Computers and Code, First Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.