+ 2

Please explain what is @staticmethod and @classmethod in python

7th Jan 2020, 3:12 AM
Rudra
2 odpowiedzi
+ 4
A regular method has 'self' as implicit first argument. This is the instance, that's supposed to be available in the method. With class methods, the class is instead passed. With static methods, nothing is passed. They behave like regular functions, only that they are in a class.
7th Jan 2020, 7:42 AM
HonFu
HonFu - avatar