When I try to use this one approach of singleton:
class Singleton(object):
def __init__(self, name, bases, dict):
super(Singleton, self).__init__(name, bases, dict)
self._instance = None
def __call__(self):
if self._instance is None:
self._instance = super(Singleton, self).__call__()
return self._instance
class NewClass(object):
__metaclass__ = Singleton
I got an error:
Error when calling the metaclass bases object.init() takes no parameters
I'm not sure, am I correctly understand what the arguments are takes __init__
method: name, bases, dict
. And actually - where is my mistake/incomprehension?