Singleton on Python
📁 python, ии
I released Singleton with wiki ()
my code:
class spritemanager ( object ): def __ New __ ( class ): if not hasttr (cls, 'Instance' ): class.instance = super (spritemanager) .__ New __ (CLS) retu cls.instance def __ init __ ( self ): self.setsprite = set () pre> every time you call spritemanager () constructs are called. According to the Singleton concept, initialization should take place once at the first call. How to make the designer call once?
Ответов пока нет.
Войдите чтобы оставить ответ