When should I use static methods and functions? Let me provide a current example. I have a class that holds stock data, and one of my static methods in the class is as follows:
class Stock:
@staticmethod
def percent_change(old, new):
return ((new - old) / old) * 100
Would it make more sense to just create the static method as a function outside of the class? As it stands, I need to call percent_change on a Stock object, but if I created a function outside of the class, I could just call the function by itself. Any thoughts?