+ 2

Static method

How to call the @staticmethod

8th Jul 2019, 3:22 AM
Mahesh Muttinti
1 Réponse
+ 1
class Person(object): #always inherit from object. @staticmethod def call_person(): print "hello person" #Calling static methods works on classes as well as instances of that class Person.call_person() #calling on class p = Person() p.call_person() #calling on instance of class
8th Jul 2019, 11:42 AM
Aditya Singh
Aditya Singh - avatar