Meaning of @classmethod and @staticmethod for beginner? [duplicate]

Could someone explain to me the meaning of @classmethod and @staticmethod in python? I need to know the difference and the meaning.

As far as I understand, @classmethod tells a class that it’s a method which should be inherited into subclasses, or… something. However, what’s the point of that? Why not just define the class method without adding @classmethod or @staticmethod or any @ definitions?

tl;dr: when should I use them, why should I use them, and how should I use them?


Leave a Comment