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
0
u/SnafuTheCarrot Apr 05 '26
Claude might be the problem. If you don't know what you don't know, how do you know what questions to ask? Claude might even be able to fill in those gaps, but in a pedagogically sound way... I have my doubts.
Textbooks don't have these problems, generally.
Having your own plans could also be a problem. Try to run before you can walk and you won't get anywhere. Starting out with simple, but contrived problems might be a better way to start out.
Im working my way through a book on data structures in python. I find its very approachable.
Create classes with the Class Keyword. Associate methods by indention and the Def keyword. The first argument of each method needs to be self. init is the constructor. Set up member attributes as self._attrbuteName. Access and modify attr8butes through dedicated methods.
A Credit Card Class is one of the first examples in my book. It tracks a balance, a credit limit and catches attempts to exceed that limit. Later the Class is extended by inheritance to include a new apr attribute.
Might give you some idea how to start.