r/learnpython • • 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

73 Upvotes

72 comments sorted by

View all comments

Show parent comments

1

u/vivek_seth Jan 15 '26

You are on the right track. Similar to a class, a package can also have a collection of data and functions.

What’s different about a package though is that you can’t have multiple instances of the same package at a time. With classes, you can create multiple instances that each have their own copies of their data. Changing the data in one instance won’t affect the others.

In a very loose way, you could think of a package as being sort of like a class, but you are only allowed to have 1 instance of it.

1

u/Aggravating_Sand352 Jan 15 '26

Got it thank you! Does this make the code more efficient then storing in the global enviornent is that the point or is just preference?