Define and call static method in a class : Static Method « Language Basics « Python






Define and call static method in a class

Define and call static method in a class


class AClass(object):
    def astatic(): 
       print 'a static method'
       
    astatic = staticmethod(astatic)

anInstance = AClass()

AClass.astatic()                    

anInstance.astatic()                

           
       








Related examples in the same category

1.class attributes and static methodsclass attributes and static methods