r/learnpython • u/Forward-Ride2950 • 23d 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
=
= ```
1) is ?
:- is
2) is ?
:- is and is
3) ?
:- is in is and
pass
50
Upvotes
View all comments
Show parent comment
4
u/xenomachina xenomachina 23d ago
Yeah, exactly. "object" and "instance" are almost but not quite synonyms. Every instance of a class is an object. Every object is an instance of some class. But you wouldn't call an object an "instance" unless the class you're saying it's an instance of was also known or stated.
Similarly, one might say that every person is a member of one or more groups. But to call a person a "member" without the group you're referring to being known or stated would seem really weird/awkward.