25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

13 satır
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