profiling - What's the best way to record the type of every variable assignment in a Python program? -
Python is so dynamic that it is not always clear what is happening in a large program, and one of the source code Little does not always help to make matters worse, editors get poor support for monitoring the definitions of talken or importing it into a Python file.
One way of indemnity may be to write a special profiler, the program will record the runtime type and path of the program's objects and expose this data to the editor.
It can be implemented with sys.settrace (), which sets the callback for each line of code and how PDB is implemented, or by using the ASTREL module and writing the code Is an import hook or better strategy for? How would you write something without it slowing down, and without moving towards extreme mobility, such as the impact of the use of the property on the side?
I do not think you can help slow it down, but it is possible to detect each variable when you encounter STORE_FAST STORE_NAME STORE_ * opcode Ho.
Whether or not it has been done before, I do not know.
If you need debugging, see, it will allow you to move through your code and use any variable.
Import pdb def test (): print 1 pdb.set_trace () # You will enter an interpreter here Print 2
Comments
Post a Comment