Static method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Static method

How to call the @staticmethod

8th Jul 2019, 3:22 AM
Mahesh Muttinti
1 Answer
+ 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