> 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()
i'm no expert on the subject, but AFAIK, there's no way to do this. why not just print "you are in method1"? what are you exactly trying to do? -- http://mail.python.org/mailman/listinfo/python-list