I'm tasked with making a function which looks at all of its children and aggregates all class variables of its children into one dictionary.
Basically:
BaseClass(object):
#implementation
classA(BaseClass):
self.var1 = 4
self.var2 = "hi"
classB (BaseClass):
self.var1 = [23,32]
self.var2 = ("Hello","World")
I'd like for a function in BaseClass to basically aggregate all class variables of its children, and make it into a dictionary that looks somewhat like this:
{"classA":{"var1":4,"var2":"hi"},"classB":{"var1":[23,32],"var2":("Hello","World")}}
This is being used for data storage at the exit of a program -- Python 2.7 Thanks so much for your help