I have a bunch of simple Python scripts with simple expressions [1]:
C = A+B D = C * 4
I need to execute them, but most importantly, I need to know which objects I rely on; in the previous case, objects A and B are external dependencies. For instance. given that I have the previous code in the var source, I want to be able to:
deps = { "A" : 1 , "B": 2} exec source in deps
therefore it is strictly necessary to know how to build dict prints.
I was hiding in the Python ast module, but I had no idea.
[1] simple mathematical aggregations, within for loops, no more.
source share