Identifying Caller

Tonguç Yumruk trooper at ttnet.net.tr
Sun Oct 12 05:27:57 EDT 2003


Is there a way to identify the caller of a function? For example:

def foo():
	print <Caller Functions name>

def bar():
	foo()

I want foo to print "bar"... And it will be great if I can also detect
call is came from which module.

Thanks.

-- 
Love, Respect, Linux
############################################################################
"And the next time you consider complaining that running Lucid Emacs
19.05 via NFS from a remote Linux machine in Paraguay doesn't seem to
get the background colors right, you'll know who to thank."
(By Matt Welsh)
############################################################################
Tonguç Yumruk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20031012/bb5d0579/attachment.sig>


More information about the Python-list mailing list