Is there a way to use the setTrace() function in a script that has no method definitions? i.e.
for i in range(1, 100):
print i
def traceit(frame, event, arg):
if event == "line":
lineno = frame.f_lineno
print "line", lineno
return traceit
sys.settrace(traceit)
so ideally I would want the trace function to be called upon every iteration / line of code executed in the loop. I've done this with scripts that have had method definitions before, but am not sure how to get it to work in this instance.