python 静态成员

class Student(object):
     #静态变量 count=0 def __init__(self, name): Student.count+=1 def show(self): print Student.count      #静态方法1 @staticmethod def haha(): print Student.count
     #静态方法2 @classmethod def ss(cls): print cls.count

  

你可能感兴趣的:(python)