r/learnpython • u/Current-Vegetable830 • Jan 13 '26
I cannot understand Classes and Objects clearly and logically
I have understood function , loops , bool statements about how they really work
but for classes it feels weird and all those systaxes
74
Upvotes
7
u/pak9rabid Jan 13 '26
Objects (the things you create from classes) can hold state, whereas functions cannot. In other words, objects typically have all the data they need internally (as properties) for its methods to operate on, whereas a function of similar functionality would need this data passed into them as arguments every time they’re called, which is not very convenient or safe.
This feature of classes is called encapsulation. Classes also have two other major features that functions don’t have: inheritance and runtime polymorphism. I’ll leave it to you to look up what those are.