Skip to main content

Benx Shen's Library tagged howto   View Popular

Caller and Callee « ActiveState Code

  • Recipe 576925: Caller and Callee











    A recipe to find out which function is the caller of the current function.












    Python


    1
    2
    3
    4
    5
    6
    7
    import inspect

    def callee():
    return inspect.getouterframes(inspect.currentframe())[1][1:4]

    def caller():
    return inspect.getouterframes(inspect.currentframe())[2][1:4]
1 - 20 of 78 Next › Last »
Showing 20 items per page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo