Python显示函数的调用者
#!/usr/bin/env python #coding:utf-8 import sys def show_caller(level=1): def show(func): def wrapper(*args, **kwargs): func(*args, **kwargs) print '{0.f_code.co_filename}:{0.f_lineno}'.format(sys._getframe(level)), "->", func.__name__ return wrapper return show @show_caller(1) def foo():pass