Static methods are simple functions that do not expect either an instance of the class (self), or the class itself (cls) as an argument.


In [1]:
from __future__ import print_function

In [2]:
class C(object):
    @staticmethod
    def f(*args):
        print('f', repr(args))

    def g(*args):
        print('g', repr(args))

In [3]:
C.f('hello', 'world')
C.g('whirled', 'peas')


f ('hello', 'world')
g ('whirled', 'peas')

In [4]:
c = C()
c.f('Halo', 'mundo')
c.g('girando', 'pisum')


f ('Halo', 'mundo')
g (<__main__.C object at 0xb4bb6bac>, 'girando', 'pisum')