django @staticmethod code example
Example: python classmethod
class point:
def __init__(self, x, y):
self.x = x
self.y = y
@classmethod
def zero(cls):
return cls(0, 0)
def print(self):
print(f"x: {self.x}, y: {self.y}")
p1 = point(1, 2)
p2 = point().zero()
print(p1.print())
print(p2.print())