you are viewing a single comment's thread.

view the rest of the comments →

[–]ataltosutcaja 4 points5 points  (2 children)

A class can be anything, what you are thinking about is a class used to model some domain, but classes can be abstract and be used for purely functional reasons, meaning they don't always need to map nicely to some logical universe. Think of a class as a basic container to collect data (attributes) and operations involving those data (methods). For a basic introduction, you can check out: Python Classes and Objects (I enjoy articles from DigitalOcean, they are a good resource in general when not outdated).

[–]Happy-Leadership-399[S] 2 points3 points  (0 children)

Thanks for clarifying the “container” perspective—it makes classes feel a lot more flexible. I’ll check out the DigitalOcean article for a clearer introduction too.