Richard Lamboj wrote:

> is there any way to get the name from the actual called function, so that
> the function knows its own name?

>>> import sys
>>> def my_name():
...     return sys._getframe(1).f_code.co_name
...
>>> def rumpelstilzchen():
...     print u"Ach, wie gut dass niemand weiß, dass ich", my_name().title(), 
u"heiß"
...
>>> rumpelstilzchen()
Ach, wie gut dass niemand weiß, dass ich Rumpelstilzchen heiß

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to