Assume I have access to the following Python module (foo.py) that was written by someone else (let's call her Ann):

import libX

for i in range(10):
    a = i + 3
b = foo()

I am the creator of libX, which Ann uses in her code.

What I am trying to do is to automatically track some variables (and their values) inside Ann's code during execution. For example, I want my doSomehting() function to be able to track the values of the variables a and b and send them to some visualization tool -during the execution of foo.py.

My doSomehting() function can already locate and identify the variables that I am interested in using Python AST (Abstract Syntax Tree).

Ann's code and my library are both written in Python.

What tool's or techniques do you recommend to accomplish this task?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.