staticmethod()

Built-in FunctionPython 2.0+Intermediate

Transforms a method so it doesn't receive the instance or class

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
class MathUtils:
    @staticmethod
    def add(a, b):
        return a + b

print(MathUtils.add(3, 4))

staticmethod() is a built-in function that transforms a method so it doesn't receive the instance or class.

Try in Playground

Tags

builtinfunctioncoreoopdecorator

Related Items