Name of a method of an instance

Richard Philips Richard.Philips at ua.ac.be
Wed Mar 28 05:36:02 EST 2001


A question on introspection:

class Log:

    def __init__(self):
        self.previous = None

    def methodA(self):
        self.previous = "methodA"

    def methodB(self):
        self.previous = "methodB"


myinstance = Log()
myinstance.methodA()
myinstance.methodB()

How can I calculate the name of the method from within the method itself
?

Thanks,

Richard Philips
University of Antwerp






More information about the Python-list mailing list