+ 2
Static method
How to call the @staticmethod
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