+ 3

Clas methods and static methods

Whts the difference between class and static method

11th Jun 2020, 6:41 PM
Manisha
Manisha - avatar
5 Respostas
+ 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