On 4/28/2010 11:44 AM Richard Lamboj said...

Hello,

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

Kind Regards,

Richi
ActivePython 2.6.1.1 (ActiveState Software Inc.) based on
Python 2.6.1 (r261:67515, Dec 5 2008, 13:58:38) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def test():pass
...
>>> dir(test)
['__call__', '__class__', '__closure__', '__code__', '__defaults__', '__delattr_ _', '__dict__', '__doc__', '__format__', '__get__', '__getattribute__', '__globa ls__', '__hash__', '__init__', '__module__', '__name__', '__new__', '__reduce__' , '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subcla sshook__', 'func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc'
, 'func_globals', 'func_name']
>>> test.func_name
'test'
>>>


Emile

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

Reply via email to