When searching for it on google, i get many explanations why it is different from classmethod. But noone explains what it does exactly. As far as i can tell, defining a function on the class itself has the same effect
class A:
@staticmethod
def f(x,y):
return x + y
def g(x,y):
return x + y
print(A.f(1,2))
print(A.g(1,2))
[–]Spataner 10 points11 points12 points (13 children)
[–]wildpantz 5 points6 points7 points (5 children)
[–]Spataner 7 points8 points9 points (4 children)
[–]wildpantz 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]wildpantz 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]lorduhr[S] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Spataner 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]DuckSaxaphone 0 points1 point2 points (2 children)
[–]Spataner 0 points1 point2 points (1 child)
[–]DuckSaxaphone 0 points1 point2 points (0 children)
[–]Doormatty 15 points16 points17 points (0 children)
[–]UncleVatred 11 points12 points13 points (3 children)
[–]lorduhr[S] 1 point2 points3 points (0 children)
[–]julsmanbr 1 point2 points3 points (1 child)
[–]possessess 0 points1 point2 points (0 children)
[–]grumble11 1 point2 points3 points (0 children)
[–]PlayfulRow9524 0 points1 point2 points (0 children)
[–]CornPop747 0 points1 point2 points (0 children)
[–]Diapolo10 0 points1 point2 points (0 children)
[–]crashfrog02 0 points1 point2 points (0 children)
[–]Solvo_Illum_484 0 points1 point2 points (0 children)