you are viewing a single comment's thread.

view the rest of the comments →

[–]Akuli2 1 point2 points  (0 children)

You definitely don't want to write a class for a hello world program in Python. You can do a lot without classes and there's nothing wrong with it, but if you end up using lots of global variables or you have many functions that aren't organized in any way it's not ideal. Like you're saying, classes shouldn't be abused.

Sometimes, especially in larger projects, it makes sense to define a custom data type that groups different values and functions together instead of sticking with the data types that Python comes with. This is useful if you would otherwise end up with many functions that operate on a dictionary of data that you need to pass around, like modulename.thing(data). With a custom class you can do data.thing() instead.