Viewing the code of a Python function

Viewed 8437

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.

4 Answers
Related