[Tutor] How to have the name of a function inside the code of this function?

Karim kliateni at gmail.com
Fri Apr 6 10:47:56 CEST 2012


Hello all,


I have :

     def foo():
            print( getattr(foo, 'func_name'))

Where I get the name of the function but I add to give the name of this 
function. Indeed it is not very helpful...
I checked the globals() but how I can do to get 
globals()['toto'].func_name. This is not more helpful ;o)

If you have any idea to get the caller name inside the caller.

Cheers
Karim


More information about the Tutor mailing list