Python Func Staticmethod
# Python2.x Python staticmethod() Function
[ Python Built-in Functions](#)
The python staticmethod returns a static method for a function.
The method does not require a mandatory first parameter. Declare a static method as follows:
class C(object): @staticmethod def f(arg1, arg2, ...): ...
The above example declares a static method **f**, which can be instantiated and used as C().f(). Of course, it can also be called without instantiation as C.f().
### Function Syntax
staticmethod(function)
Parameter Description:
* None
### Example
#!/usr/bin/python# -*- coding: UTF-8 -*-class C(object): @staticmethod def f(): print('tutorial'); C.f(); # Static method does not require instantiation cobj = C()cobj.f()# Can also be called after instantiation
The output of the above example is:
tutorial tutorial
[ Python Built-in Functions](#)
YouTip