Access function name from within a function

Hellmut Weber mail at hellmutweber.de
Wed Mar 12 19:16:13 EDT 2008


Hi,
i would liek to define an error routine which print amongs other things 
the name of the function from which it has been called.

Having tried

def foo():
   print dir()

and all other ideas which came to my (rather python newbie) mind.

Googling too did not show me a possibility.

IOW what I'm looking for is:

def bar():
   name = some_function(some-parameter)
   print name

should print 'bar'

Any ideas appreciated

Hellmut

-- 
Dr. Hellmut Weber         mail at hellmutweber.de
Degenfeldstraße 2         tel   +49-89-3081172
D-80803 München-Schwabing mobil +49-172-8450321
please: No DOCs, no PPTs. why: tinyurl.com/cbgq




More information about the Python-list mailing list