I'm trying to refactor some code where I instantiate a lot of different classes and set their properties and wondered if I might be able to use a dictionary in some way.
Is it possible in python to get from the following:
class Class1:
pass
class Class2:
pass
class Class3:
pass
test_dict = {"test1":Class1(), "test2":Class2(), "test3": Class3()}
to a list of class instances with the keys as the variable name. If the answer is no, that's fine.
Eg. I want
test1 = Class1()
test2 = Class2()
test3 = Class3()
exec(),eval()orglobals()[key]?