Clas methods and static methods | SoloLearn: Learn to code for FREE!


Clas methods and static methods

Whts the difference between class and static method

6/11/2020 6:41:30 PM


5 Answers

New Answer


HonFu thank you for that very good, simple explanation. You nailed it, and I think I needed to see it written to help me remember the difference. Thank you! Thank you! 😎👍 Manisha thank you for asking the question. I have been struggling on some of the OOP concepts and this helped. 👍


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).


Manisha The main difference is static method can be call without creating the object of class means we can directly access with class.


Manisha while reviewing OOP again and still not fully grasping everthing I found another awesome series on youtube that really made things understandable: There is a video dedicated to class and static methods: (And thank you SoloLearn for getting me started, but your OOP curriculum could use some rework... a lot of users agree, read the comments. 😉).