Getting method name from within the class method

Mitko Haralanov mitko at qlogic.com
Wed Oct 18 16:59:55 EDT 2006


I need to be able to get the name of the currently executed method
within that method. I know that the method object does have the
__name__ attribute but I know know how to access it from withing the
method.

Something like this:

class A:
....
    def a_method (self, this, that):
         print <__name__>

a = A ()
a.a_method()
'a_method'


Thanx for your help!
-- 
Mitko Haralanov					 mitko at qlogic.com
Senior Software Engineer			     650.934.8064
System Interconnect Group		    http://www.qlogic.com




More information about the Python-list mailing list