Singleton on Python
📁 Advanced Python Topics, AI
I implemented Singleton using wiki()
my code:
class SpriteManager(object):
def __new__(cls):
if not hasattr(cls, 'instance'):
cls.instance = super(SpriteManager).__new__(cls)
return cls.instance
def __init__(self):
self.setsprite = set()
every time you call s