I have the below sample code:
def sample(cls):
class a():
def __init__(self):
self.value='a'
class b():
def __init__(self):
self.value='b'
def __init__(self):
self.cls=cls()
return self.value
sample(b)
I have defined 2 classes in the sample code. I want to be able to define the class name in a function. So the above code will return 'b'. Is there a way to do it? The above code will give me the error:
'str' object is not callable