Python script that print its source
Is it possible (not necessarly using python introspection) to print the
sorce code of a script?
I want to execute a short python script that also print its source (so I
can see which commands are executed).
The script is something like this:
command1()
#command2()
command3()
print some_variable_that_contain_src
The real application is that I want to run a script from IPython with the
run -i magic and have as output the source (i.e. the commands executed).
In this way I can check which commands are commented at every execution.
Moreover, if executed in a Notebook I leave a trace of which commands have
been used.
No comments:
Post a Comment