Let’s say I’m working in the Python shell and I’m given a function f. How can I access the string containing its source code? (From the shell, not by manually opening the code file.)
I want this to work even for lambda functions defined inside other functions.
inspect.getsource
It looks getsource can’t get lambda’s source code.