Calling Python static methods using the class name is more common, but can be a real eye sore for long class names. Sometimes I use self within the same class to call the static methods, because I find it looks cleaner.
class ASomewhatLongButDescriptiveClassName:
def __init__(self):
# This works, but it's an eyesore
ASomewhatLongButDescriptiveClassName.do_something_static()
# This works too and looks cleaner.
self.do_something_static()
@staticmethod
def do_something_static():
print('Static method called.')
My understanding is that calling a static method with self gets interpreted as ClassName.static_method(self), where self would be ignored by the static method.
(EDIT: The above statement is only true for instance methods, not static methods)
Are there any concrete reasons why I should not use self to call static methods within the same class?
FWIW This is a sister question to Difference between calling method with self and with class name?, which deals with non-static methods.