getting current call stack

Alex new_name at mit.edu
Thu Jun 7 12:12:12 EDT 2001


Is there any way to determine the current call stack from a method/function?

Use the traceback module.  eg

import traceback, pprint

def where():

    pprint.pprint(traceback.extract_stack())
    
if __name__ == '__main__':
    where()


HTH
Alex.



More information about the Python-list mailing list