Find function name in function

Sean Ross frobozz_electric at hotmail.com
Tue May 20 15:53:41 EDT 2003


As a bonus, this even works for methods:

# I've changed the name of whoami2 to whoaminow
class c:
    def foo(self):
        print whoaminow()

inst = c()
inst.foo()
bar = inst.foo
bar()

#OUTPUTS
foo
bar







More information about the Python-list mailing list