What's the benefit of using classmethods?
i been watching videos of this topic because i found this kinda complicated,this is an example of a classmethod class Employee: raise_amt = 1.04 def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay def apply_raise(self): self.pay = self.pay * self.raise_amt @classmethod def set_raise_amt(cls, amount): cls.raise_amt = amount emp1 = Employee("user", "test", 1200) emp2 = Employee("use2", "test2", 12000) Employee.set_raise_amt(1.05) print(Employee.raise_amt) print(emp1.raise_amt) print(emp2.raise_amt) Employee.raise_amt = 1.02 print(Employee.raise_amt) print(emp1.raise_amt) print(emp2.raise_amt) but as you can see, i got the same result changing the class attribute instead of using this class method ... so i dont understand the real use of classmethods