I have the following example class:
Syntax: Select all
class MyClass(object):
# ... some instance methods ...
@staticmethod
def my_static_method(value):
return value * 5
# Global instance for the class
my_class = MyClass()
# ...
# Since it's a static method, it should be called like this:
fifty = MyClass.my_static_method(10)
# But is it OK to do the following as well?
fifty = my_class.my_static_method(10)