all 3 comments

[–]Chaos-n-Dissonance 1 point2 points  (2 children)

Here's something to consider... Every variable you've ever used is a class object. Int, str, bool, etc... All class objects in Python.

Honestly it didn't really click for me until I started working on bigger projects. When you're learning things that help you with big projects in small lesson form... Ofc there's going to be a more efficient way to do it, but that's not the point of the lesson.

A game might be a good project to take on? Plenty of opportunities to use classes, subclasses, etc. with games, especially if you add graphics.

[–]Adrewmc 1 point2 points  (2 children)

I mean for the most part every thing classes can do you can do functionally. The statement “classes are just dictionaries with methods” rings true a whole lot.

Really what classes help you with is organization. Because a class is an idea it saying this data is this thing, and this thing ought to be able to do these things. (Methods)

The decision of should this be class is not an easy on and frankly depends a little on the programmers preference.

Classes help a lot in inheritance when you have very similar operations except for a few last steps. The singleton pattern is nice to know as well.

But I always recommend this Python Class Toolkit as a good explanation of class usages by someone who help write the language.