Getting method name from within the class method

Fredrik Lundh fredrik at pythonware.com
Thu Oct 19 02:08:40 EDT 2006


Mitko Haralanov wrote:

> 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__>

	print "a_method"

</F>




More information about the Python-list mailing list