Disambiguating Class and Instance
00:00 Class and instance. Let’s clear up those terms a little bit, because you’ll be working very heavily with classes and instances, and it’s very important that you have a clear idea of what each means.
00:12 A class you can think of like a blueprint. You can think of it like a prototype or a model. The instance, on the other hand, is a specimen or a occurrence or an occasion. So in the case of a blueprint, you’d have a blueprint maybe for a car, and the instance would be the actual car.
00:33 Let’s look at a few examples. Here you have classes on the left and examples of the instances on the right. So as a class, you could have the mammal Canis familiaris, also known as dogs.
00:46 And the instance of this class could be your dog Spike. Likewise, you can have the concept of a point in two-dimensional space with an x and y coordinate, and then you can have an instance of a point which is the center of a canvas that you’re going to draw on. And you can have the idea of a chair.
01:04 So everyone knows what a chair is. It’s something that you can sit on, but the instance is the actual chair or the many chairs that are available for you to sit on. Just to hammer this home, a class is like a blueprint, and an instance is something that is made from a blueprint.
01:22 Now all of these analogies and examples are just to help you really understand the difference between classes and instance when it comes to Python.
01:31 Remember that analogies are limited. None of these analogies really fully encapsulate everything that goes into a Python class and instance.
Become a Member to join the conversation.