Clas methods and static methods | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 3

Clas methods and static methods

Whts the difference between class and static method

11th Jun 2020, 6:41 PM
Manisha - avatar
2 ответов
+ 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 - 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 - avatar