r/PythonLearning • u/Defiant_Meal1898 • Oct 28 '26
I don't understand OOP
So i am a teen learning python, and i have learnt about classes, methods and objects, but i don't understand OOP, like what is it, where do we use it?
Please help mee
36
Upvotes
View all comments
1
u/NMC0152 Oct 28 '26
OOP is a way of encapsulating code, give it a public interface and leave the inner workings to the developer of the object.
It's like a power outlet in the wall (the object): you plug in your charger without having to know how the outlet is assembled.
The original idea was to have reusable objects that anyone can use, so, for example, you can instantiate a File object and make it read, write, open, and close files without you having to code nitty gritty details.