using trace to do 'in place' evaluation of variables

Edward Peschko horos11 at gmail.com
Tue Dec 7 17:21:18 EST 2010


All,

I've been using the trace module for python (as per
http://www.dalkescientific.com/writings/diary/archive/2005/04/20/tracing_python_code.html),
and would very much like to have a feature there that I've implemented
for perl already.

Namely, I would like output in the format as described on that page,
but with the ability to have the running window partitioned into 2,
like:


/tmp/file.py:13: yy = 12         |   = 12
/tmp/file.py14:  xx = yy         |   = 12

where the window on the left shows the actual source code, and the
right shows how that code eval's (ie: how the scalars resolve based on
their current scope.)

Is this possible given the current trace functionality? I've found it
an *incredible* time saver with my perl code, especially for hard to
find data bugs - to debug I simply look for a pattern which is
associated with a given bug, and then backtrack that pattern to where
it first appeared in my code.

Also, is there a good archive searcher for the python-list archives?
Short of doing a complete download of
http://mail.python.org/pipermail/python-list/ and indexing it, I don't
see how I can do a decent pattern search on previous archive entries..

Thanks much,

Ed



More information about the Python-list mailing list