We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

staticmethod

staticmethod(function)

Returns a static method for function.

A static method does not receive an implicit first argument. To declare a static method, use this idiom:

class C:
    @staticmethod
    def f(arg1, arg2, ...): ...

The @staticmethod form is a function decorator — see the description of function definitions in chapter 7 of the [Python Reference Manual][27] for details.

It can be called either on the class (such as C.f()) or on an instance (such as C().f()). The instance is ignored except for its class.

Static methods in Python are similar to those found in Java or C++. For a more advanced concept, see classmethod.

For more information on static methods, consult the documentation on the standard type hierarchy in chapter 3 of the [Python Reference Manual][17] (at the bottom). New in version 2.2. Changed in version 2.4: Function decorator syntax added.