I have a class as such:
class ABC():
def __init__(self, details):
for key, value in self.details.items():
setattr(self, key, value)
def get_details(self, id):
details = {'a':1,'b':2,'c':3}
return self.details
I am calling the class in another file as such:
my_class = ABC(details={})
my_var = my_class.get_details('some_id')
So I have a dictionary returned from a class method, I want it's values to be assigned as class variables so that I can call them using my_class.a
and so on for all the returned dictionary keys...
How can I achieve this, and is this the right approach I'm taking?