How to refer to the function object itself in the function per se?
Sullivan WxPyQtKinter
sullivanz.pku at gmail.com
Sat Mar 11 15:23:28 EST 2006
When debugging using 'print' statement, I usually want to print some
important values together with the function name as the context of the
values printed out. So my hope is that I could get the name of the
function.
Since every function object actually has a private __name__ attribute
that gives its name, but when I
print __name__
in a function, it usually print the public module-level __name__
attribute, ie, 'main', rather than the function level __name__. So how
could I refer to the function object per se, in the body of the
function itself?
More information about the Python-list
mailing list