So, I did not know what static methods were so i searched it up and i made this
class Calculator:
def __init__(self,num1,num2):
self.num1 = num1
self.num2 = num2
@staticmethod
def add(x,y):
result = x + y
return result
def sub(x,y):
result = x-y
return result
Calculator.add = staticmethod(Calculator.add)
print(Calculator.add(3,4))
print(Calculator.sub(5,7))
as you can see, line 19 still works even without doing something like line 15, i just want to know how to use a static method, from what i have understood, a static method allows you to invoke it without creating an instance/variable to it. how does line 19 still works if there is (no line 15 but for line 19?)
Basically, I'm asking why the sub method works in a static context even without the staticmethod decorator?