python staticmethod classmethod

class myClass:

    def  smeth():
        print("smeth function")
    smeth = staticmethod(smeth)

    def cmeth(cls):
        print("cmeth function")
    cmeth = classmethod(cmeth)


print(myClass.cmeth())
print(myClass.smeth())

result:

cmeth function
None
smeth function
None

 

posted @ 2019-06-25 13:24  嵌入式实操  阅读(135)  评论(0编辑  收藏  举报