getting the function name
M.Waack at gmx.de
Fri Sep 17 19:59:49 CEST 2004
beliavsky at aol.com wrote:
> Is there a way in Python to print the name of the function one is
> currently in?
>>> def f():
... tb = traceback.extract_stack()
... print tb[-1]
I'm using a more comfortable way by setting a global debug flag and
enabling tracing (see sys.settrace). This gives you the same feature
without adding code to each function.
More information about the Python-list