0

I am try to get all class variables and their values for a running script while using evals.

Here is the current implementation

class_vars = eval("dir(self)")
for var in class_vars:
    value = eval("self." + var)

Though, this is not optimal and takes a long time to process. So, Is there any way to improve this so fewer evals are needed (Preferably once, getting all the values) to fetch all class variables and their values.

0 Answers0