What decorator is used to define a static method in a class?
Answer
@staticmethod
Answer
@staticmethod
What decorator is used to define a static method in a class? The decorator is @staticmethod. It tells Python to keep the function in the class namespace without automatically binding an instance or class as its first argument.
A static method behaves much like an ordinary function grouped inside a class for organizational purposes. It receives only the arguments explicitly passed by the caller, so it cannot directly use instance state through self or class state through cls. It can be called through either the class or an instance, although calling it through the class usually communicates its role more clearly.
This differs from @classmethod, which receives the class as its first argument, and from ordinary instance methods, which receive the instance. @property creates attribute-style access, while @abstractmethod marks an interface requirement and is not primarily about method binding. Static methods are useful for validation, conversion, or other helpers closely related to a class but independent of a particular object.
Source: Wikipedia · fact-checked Aug. 2026