Created
March 31, 2019 23:27
-
-
Save luhn/d1dac5eff4d6fd0018ae12eac48e94e0 to your computer and use it in GitHub Desktop.
Revisions
-
luhn created this gist
Mar 31, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ import sys import inspect def wrap(func): attach() return func def attach(): frame = sys._getframe(2) info = inspect.getframeinfo(frame) # Python 3.7: "@wrap" # Python 3.8: "def a():" print(info.code_context[0]) @wrap def a(): pass