Finding the calling method

Skip Montanaro skip at pobox.com
Tue Jan 14 21:41:08 CET 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