Clas methods and static methods | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Clas methods and static methods

Whts the difference between class and static method

11th Jun 2020, 6:41 PM
Manisha
Manisha - avatar
2 Answers
+ 4
Classmethods AND static methods can be called without an instance. Try this: class C: @classmethod def f(cls): print('Method of', cls) C.f() The main difference is that static methods have no implicit first argument, neither self (the instance) nor cls (the class).
11th Jun 2020, 6:56 PM
HonFu
HonFu - avatar
+ 2
Manisha The main difference is static method can be call without creating the object of class means we can directly access with class.
11th Jun 2020, 6:44 PM
A͢J
A͢J - avatar