Return name of caller function?
Stephen R Laniel
steve at laniels.org
Tue Jun 26 11:56:47 EDT 2007
On Mon, Jun 25, 2007 at 06:27:29PM -0700, Matthew Peter wrote:
> For example, how do I get this to work?
>
> def func():
> print "This is", __?__
> return __caller__
>
> def echo():
> print "This is ", __?__
> return func()
inspect is your friend:
http://docs.python.org/lib/inspect-stack.html
--
Stephen R. Laniel
steve at laniels.org
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
More information about the Python-list
mailing list