r/learnpython • • 19d ago

Trying to understand Class, Object, Instance, and self in Python. Is my understanding correct?

I'm currently learning OOP in Python and wrote down some questions regarding object and instance for following code

class Car:
    def __init__(self, color):
        self.color = color

car1 = Car("Red")```

 1) what is class ?

ans :-  a class is an blueprint for thing i want to make.

2) what is object ?

 ans:-  an object is a container that contains properties and behaviours like car1 is object saying that car should be red color

3) what are instances ?

 ans:-  an instance is refers to that specific object in this case car1 is object and also an instance
when we pass self parameter self become car1 cause self points towards that instance
50 Upvotes

33 comments sorted by

View all comments

6

u/ninhaomah 19d ago

Just curious. The textbook or the site you are reading defines what is an object as well ?

Class ok. Instance ok. But object ?

1

u/Forward-Ride2950 19d ago edited 19d ago

From the few books I have read and to my understanding we create object  from class cause  we want diffrent property of that class