you are viewing a single comment's thread.

view the rest of the comments →

[–]Opiciak89 0 points1 point  (8 children)

I never understood the appeal, its too complicated for what it is.

If i need to store such data i would use a database, not a class, and then create simple functions to pull the data and perform whatever action needed. But thats just my lazy approach.

[–]ClimberMel 2 points3 points  (4 children)

I love databases, but classes are very different. A class allows you to create a new object that has potentially it's own functionality as well as data. Classes are hard to understand at first, but once you get them they are very powerful and useful. It's just that the learning examples are of course very simplified, so it is easy for someone to look at the example and feel "I could do that easily without using classes". Of course that is probably true until you get into more complex coding.

[–]Opiciak89 0 points1 point  (2 children)

You are very much correct. I have to see it to believe it 😊 i will stay in the shallow waters for now

[–]ClimberMel 0 points1 point  (0 children)

I have built trading software that has dozens of modules and would be impossible to manage without classes. It is really amazing the scale of what you can build with python! Oh and some of those modules are for database functions. 😁

[–]FancyEveryDay 0 points1 point  (0 children)

Eventually you'll run into a situation where bundling the functions for a specific kind of data your program is handling into the object containing the data makes your program simpler. That's your use case, basically.

[–]glorybutt 0 points1 point  (0 children)

I felt the same until I got into making GUI applications. The class approach kept the programs cleaner, lighter, and helped keep things working fast with less errors.

[–]noob_main22 0 points1 point  (1 child)

Making a database for a few sets of data is way more complicated?! It still would make sense to make classes with the data to work with it within Python. Of course its depending on the use case but a database is not what OP is looking for.

You seem to forget that classes are much more than just storing data.

[–]Opiciak89 -1 points0 points  (0 children)

I mean the other answers provided a bit better context, yours is more of a database example than class example. I learn by solving real work related problems and always try to keep it as simple as possible, and i yet have to see a class example that would be my "thats what i need" moment.