classmethod in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

classmethod in python?

What is classmethod and staticmethod inn python(@classmethod or @staticmethod)? Why we use this methods?

10th Jun 2018, 2:15 PM
Om Kumar
Om Kumar - avatar
1 Answer
+ 3
Though classmethod and staticmethod are quite similar, there's a slight difference in usage for both entities: classmethod must have a reference to a class object as the first parameter, whereas staticmethod can have no parameters at all. See the link for more. https://stackoverflow.com/questions/12179271/meaning-of-classmethod-and-staticmethod-for-beginner
10th Jun 2018, 2:22 PM
Akash Pal
Akash Pal - avatar