how can I get the name of a method inside it?
Sébastien Vincent
sebastien_nimp73
Sun Jun 3 15:26:40 EDT 2007
I would like to know if it's possible to retrieve the name of a method when
you're inside it. For example, in the following script, I would like to
assign _s so that it prints "you are in method1".
***************************************
class Obj1:
def __init__(self):
...
def method1(self):
_s = ???
print "you are in %s" % _s
x = Obj1()
x.method1()
More information about the Python-list
mailing list