1 ############################################### 2 # 3 # Odds and ends for debugging 4 # 5 ############################################### 6 7 def print_call_chain(*args): 8 import sys 9 print(" ".join(map(str, args))) 10 f = sys._getframe(1) 11 while f: 12 name = f.f_code.co_name 13 s = f.f_locals.get('self', None) 14 if s: 15 c = getattr(s, "__class__", None) 16 if c: 17 name = "%s.%s" % (c.__name__, name) 18 print("Called from: %s %s" % (name, f.f_lineno)) 19 f = f.f_back 20 print("-" * 70) 21