Name of the function

Olaf Meding OlafMeding at compuserve.com
Thu Jan 8 09:40:37 EST 2004


I am looking for a way to get at the name of the function (while
executing code inside the function) without (!) knowing the name of
the function.

The code below works, but requires the name of the function.  I am
looking for a way to do the same w/o specifying the name of the
function.

def olaf():
    # requires name of the function
    print olaf.__name__

    # this does not work
    print self.__name__



More information about the Python-list mailing list