George Sakkis wrote: > > Oh, I overlooked this. Then the solution becomes simple: > > > > sys._getframe().f_trace > > > > Test: > > > > >>> an = Analyzer() > > >>> sys.settrace(an.trace_returns) > > >>> sys._getframe().f_trace > > <bound method Analyzer.trace_returns of <__main__.Analyzer instance > at > > 0x010015D0>> > > Does this work for you non-interactively ? I tried running it from a > script or importing it from a module but it returns None. Very > strange... > > George
You are right. The expression was context-dependent :-/ I had not yet the time to analyze the output of the following function but it returns stable values: def gettracefunc(): import sys i = 0 while 1: try: f_trace = sys._getframe(i).f_trace if f_trace: return f_trace i+=1 except ValueError: break Ciao, Kay -- http://mail.python.org/mailman/listinfo/python-list