Trace function with automatic source code location reporting

Uwe.Hoffmann at Uwe.Hoffmann at
Thu Feb 8 03:03:24 EST 2001


Jürgen Hermann wrote:

>>The following is the core of a tracing function, is there any less obscure
>>                 way to get the location of the caller?

Maybe you are looking for :            
	tb = traceback.extract_stack()[-2]
            print "%s,%i,%s: " %(tb[0],tb[1],tb[2],) ,


More information about the Python-list mailing list