ID EN
Built-in Functions

classmethod

Python 3.11

Transform a method into a class method.

Syntax

PYTHON
@classmethod

Examples

Example 1
PYTHON
class C:
    @classmethod
    def f(cls, arg1, arg2): ...

See Also

decorator Function definitions staticmethod() The standard type hierarchy descriptors property() descriptors property()