Name of function within the function?

Dula, Debbie (EXCHANGE:RICH2:2C25) violet at americasm01.nt.com
Thu Jul 1 11:41:35 EDT 1999


I've looked and looked, but can't find the answer to this ... I'm
sure it's right in front of me ...


I want the current function's name to be output in my error
messages, but can't figure out how a function can get its own name
(without already knowing it).  For example,

	def f1():
		print "Error in function", f1.__name__

is not really useful for what I need as I might as well print "Error
in function f1".  Is there any generic way I can get the current
function's name?

Thanks,
Debbie




More information about the Python-list mailing list