Next / Previous / Contents / TCC Help System / NM Tech homepage

21.20. staticmethod(): Create a static method

The purpose of the staticmethod function is to convert a method into a static method. See Section 26.4, “Static methods” for definitions and usage.

Typically you will declare a static method using the decorator syntax, like this:

    def methodName(...):
        method body

An alternative is to place a line like this after the method's definition (at the same indentation level as its def):

    methodName = staticmethod(methodName)