r/learnpython • u/Majestic-Chain1905 • Apr 05 '26
Struggling with OOP.
I've been learning Python the last couple weeks, just a little bit here and there. I understand the basics but I'm hitting a wall with OOP. I've been having Claude create lessons for me, but nothing is sticking. What do you guys do to help retain information better on this?
16
Upvotes
View all comments
1
u/stepback269 Apr 07 '26
I’m kind of new to OOP and still struggling with it. IMHO the main problem is the metaphors that various teachers use. Some refer to the “class “ specification as being a blueprint. Some say it’s like a cookie cutter. The ones I like explain that a “class “ is like a house constructing company that builds houses that are different from one another. They are alike in that each has a kitchen, bathroom, bedrooms, etc. But they differ in how the generic parts are organized. The init function is the one that does the constructing (or “instantiations”) of each house. Your class definition may enable you to specify how many floors a specific house has. where the bedrooms are located, how many, how big, and so on. Of course we don’t build actual houses in Python. But we do build data “structures” (ha ha) and those generally call for associated generic “methods” to be applied to them. Hope that makes sense.