Home Tutorials Python OOP Concepts Static Method
Static Method

Static Method


26. Static Method

A static method belongs to the class namespace but does not use self or cls. It is useful for helper functions related to the class.

Syntax

@staticmethod
def method():
    pass

Example

class MathTool:
    @staticmethod
    def add(a, b):
        print(a + b)

MathTool.add(10, 20)

Output

30
Example

🏋️ Test Yourself With Exercises

Take our quiz on Static Method to test your knowledge.

Browse Quizzes »