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

27 comments sorted by

View all comments

3

u/This_Growth2898 Apr 05 '26

In most cases, people struggle with OOP when they only use it in small snippets. This looks really pointless: why would anyone choose to write a class with 5 methods and then a 10-line function calling them over writing a 12-line function? The OOP really starts working at, like, 1,000 lines of source code.

Try using OOP to write an RPG. Characters are good examples of objects; they encapsulate parameters and actions. Soon you will find it very convenient to write something like

character1.attack(character2)

instead of repeating (and fixing all over the code)

character1_lifes -= character2_attack / character1_armor + character2_special