I have base class which is singleton, i need to inherit that in my another class but i get error message as TypeError: Error when calling the metaclass bases function() argument 1 must be code, not str
Can someone help with this. Below is sample code.
def singleton(cls):
instances = {}
def getinstance():
if cls not in instances:
instances[cls] = cls()
return instances[cls]
return getinstance
@singleton
class ClassOne(object):
def methodOne(self):
print "Method One"
def methodTwo(self):
print "Method Two"
class ClassTwo(ClassOne):
pass