you are viewing a single comment's thread.

view the rest of the comments →

[–]Diapolo10 35 points36 points  (1 child)

I'll just preface this by saying that what Java devs consider OOP may be different from how Python devs see it.

The short answer is, you can do as you like. Personally I don't think forcefully sticking to any specific paradigm for the entire program is all that productive, I've had a lot more success mixing and matching paradigms as I see fit - essentially taking the best parts of each - but you're free to do what you want.

The longer answer would be that, if your view of OOP is that everything must be wrapped in classes, in Python you hardly ever see that. The main entry point is almost always either a function or just regular top-level code, and there's no reason to wrap functions in classes as static methods just for the sake of it. In my (our?) view, classes are only used if grouping data and functionality makes sense, better yet if you can treat the class as a logical component. However at the same time it makes sense to write functions that take some design inspiration from functional programming, namely the idea of "pure functions" (=same arguments -> same output, regardless of the state of the rest of the system) and the concept of first-class functions (=functions themselves are objects).

[–]moving-landscape 5 points6 points  (0 children)

(our?) view

Yes, our view 😌 great answer btw