In Python, classmethod() is an built-in function. The classmethod() method returns a class method for the given function.
A class method is a method that is bound to a class rather than its object. It doesn't require creation of a class instance.
It can be called as a both class or object.
This function accepts the function name as a parameter that needs to be converted into a class method.
This function returns the converted class method.
class abc(): place = "xyz" def place_1(obj): print("The place is:",obj.place) abc.place_1 = classmethod(abc.place_1) abc.place_1()
Output: The place is: xyz