您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

13 行
399 B

  1. #!/usr/bin/python
  2. # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
  3. class Singleton(type):
  4. def __init__(cls, name, bases, dict):
  5. super(Singleton, cls).__init__(name, bases, dict)
  6. cls.instance = None
  7. def __call__(cls,*args,**kw):
  8. if cls.instance is None:
  9. cls.instance = super(Singleton, cls).__call__(*args, **kw)
  10. return cls.instance