Finding the calling method

Skip Montanaro skip at pobox.com
Tue Jan 14 15:41:08 EST 2003


    Mark> Is there a way while I'm inside method B to find out what method
    Mark> called it, which would be method A.

Check out sys._getframe() and various functions exposed in the inspect
module (getframeinfo(), currentframe(), stack(), etc).

Skip





More information about the Python-list mailing list