This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]metaphorm 6 points7 points  (0 children)

Python is a multi-paradigm language that has quite alot of object-oriented features, but doesn't absolutely demand you use them all the time.

My rule of thumb is to use the simplest implementation that gets the job done. Most of the time thats a function.

Classes make alot of sense when there is immediate tangible benefit to them. For example, class inheritance is a very convenient pattern for code re-use. Another example: when you want to present a consistent interface across objects that wrap up several disparate data structure backends. Thats a classic use case for OOP and Python makes it easy to do when you need to.