Skip to content
Built-in Functions

staticmethod()

Make a method that does not receive an object or class automatically.

staticmethod(function)

A static method lives inside a class but does not need self or cls.

The @staticmethod decorator is the usual way to define one.

Parameters

NameDescription
functionThe function to place in the class as a static method.

Returns

A static method descriptor.

Try it

Run it and change it
class Greeter:
    @staticmethod
    def hello(): return "Hello"
print(Greeter.hello())

Related entries