Python @staticmethod Last Updated : 21 Nov, 2019 Comments Improve Suggest changes Like Article Like Report There can be some functionality that relates to the class, but does not require any instance(s) to do some work, static methods can be used in such cases. A static method is a method which is bound to the class and not the object of the class. It can’t access or modify class state. It is present in a class because it makes sense for the method to be present in class. A static method does not receive an implicit first argument. Syntax: class C(object): @staticmethod def fun(arg1, arg2, ...): ... Returns: a static method for function fun. When function decorated with @staticmethod is called, we don’t pass an instance of the class to it as it is normally done with methods. It means that the function is put inside the class but it cannot access the instance of that class. Example #1: Python3 1== # Python program to # demonstrate static methods class Maths(): @staticmethod def addNum(num1, num2): return num1 + num2 # Driver's code if __name__ == "__main__": # Calling method of class # without creating instance res = Maths.addNum(1, 2) print("The result is", res) Output: The result is 3 Example #2: Python3 1== # Python program to # demonstrate static methods class Person: def __init__(self, name, age): self.name = name self.age = age # a static method to check if a Person is adult or not. @staticmethod def isAdult(age): return age > 18 # Driver's code if __name__ == "__main__": res = Person.isAdult(12) print('Is person adult:', res) res = Person.isAdult(22) print('\nIs person adult:', res) Output: Is person adult: False Is person adult: True Comment More infoAdvertise with us Next Article Python @staticmethod N nikhilaggarwal3 Follow Improve Article Tags : Python Python-OOP Practice Tags : python Similar Reads Python staticmethod() Function Python staticmethod() function is used to convert a function to a static function. Static methods are independent of class instances, meaning they can be called on the class itself without requiring an object of the class.Example:Pythonclass Utility: def msg(name): return f"Hello, {name}!" msg = sta 6 min read Python Pyramid - Static Assets A lightweight web framework in Python that converts small web apps to large web apps is called Pyramid. There are various circumstances when the user needs to add some images, HTML code, CSS code, etc. along with the Python code in the web app. These are called static assets and can be added using t 5 min read Class or Static Variables in Python All objects share class or static variables. An instance or non-static variables are different for different objects (every object has a copy). For example, let a Computer Science Student be represented by a class CSStudent. The class may have a static variable whose value is "cse" for all objects. 9 min read Bound, unbound, and static methods in Python Methods in Python are like functions except that it is attached to an object.The methods are called on objects and it possibly make changes to that object. These methods can be Bound, Unbound or Static method. The static methods are one of the types of Unbound method. These types are explained in de 5 min read Multimethods in Python Multimethod basically means a function that has multiple versions, distinguished by the type of the arguments. For better understanding consider the below example. @multimethod def sum(x: int, y: int): return x + y @multimethod def sum(x: str, y: str): return x+" "+y The above example is similar to 2 min read Like