Suppose I create a class with a static method and want to run that method from another classes method or script function.
What is the scope of the static method?
ex:
def Class myClass:
@staticmethod
def mystaticmethod(input):
print("blah")
def scriptfunc():
myClass.mystaticmethod()
Is this valid?
What you have is valid.
But too elaborate on the purpose of @staticmethod
, here's Short answer:
Declaring a @staticmethod
would mean 2 things:
__init__
or a super method to override it's content or attributes, and doesn't require a subclass/parent class to handle itself.