function which knows who has called it.
Michael P. Reilly
arcege at shore.net
Tue Aug 17 02:53:10 CEST 1999
Phil Hunt <philh at vision25.demon.co.uk> wrote:
: Is if possible in Python to have a function that prints the name
: of the function that called it. (I'm thinking of using this in
: some debugging code I want to write).
The information is captured in the frames in the traceback.
exc, val, tb = sys.exc_info()
frame = tb.tb_frame.f_back
del exc, val, tb
except AttributeError: # called from the top
WhoCalledMe = you_rang()
More information about the Python-list