sys._getframe([depth])
Return a frame object from the call stack. If optional integer depth is given, return the frame object that many calls below the top of the stack. If that is deeper than the call stack, ValueError is raised. The default for depth is zero, returning the frame at the top of the call stack.
#executer.py
executer.exe()
#caller.py
def do_exe():
print sys._getframe().f_code.co_filename #当前文件名,可以通过__file__获得. getframe()方法的参数默认为0
print sys._getframe(0).f_lineno #当前行号
print sys._getframe(0).f_code.co_name #当前函数名
print sys._getframe(1).f_code.co_name #调用该函数的函数的名字
print sys._getframe(2).f_code.co_name #调用上一个函数的调用者
def exe():
do_exe()