def getFunctionCall(idx=1):
"""Returns the name of function or method that was called idx frames outwards.
.. note:: ``idx=0`` will of course return ``getFunctionCall``.
Args:
idx (int): Steps outwards.
Returns:
str: Name of function or method.
"""
frame = inspect.currentframe()
try:
return inspect.getouterframes(frame)[idx][3]
except IndexError:
return ""
评论列表
文章目录