How to differentiate between “a string” and “a actual code” in python?
My works relates to instrumentation of code fragments in python code. So in my work i would be writing a script in python such that I take another python file as input and insert any necessary code in the required place with my script. The following code is a sample code of a file which i would be instrumenting: A.py #normal un-instrumented code statements .... .... def move(self,a): statements ...... print "My function is defined" ...... statements ...... My script what actually does is to check each lines in the A.py and if there is a "def" then a code fragment is instrumented on top of the