By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

Access function name from within a function

P: n/a
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


Dr. Hellmut Weber ma**
Degenfeldstraße 2 tel +49-89-3081172
D-80803 München-Schwabing mobil +49-172-8450321
please: No DOCs, no PPTs. why:

Mar 12 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.