Created
October 27, 2018 08:03
-
-
Save AdityaSoni19031997/5416a519d582b2f08f8b80141033afc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import sys | |
def trace_calls_and_returns(frame, event, arg): | |
co = frame.f_code | |
func_name = co.co_name | |
if func_name == 'write': | |
# Ignore write() calls from print statements | |
return | |
filename = co.co_filename | |
if event == 'call': | |
print f'(func_name , filename) | |
return trace_calls_and_returns | |
return | |
sys.settrace(trace_calls_and_returns) | |
#your function call will now generate a huge output to indicate what all did it called (it will be a huge and will be default for every | |
#function call there onwards) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment