If you are looking for a source for an interactively defined function, you can find the latest definition of this in iPython history:
[i for (i, l) in enumerate(_ih) if l.startswith('def foo(')][-1]
Then you can edit this line:
%edit 42
It will open Notepad or another text editor with the definition of the function in it.
Or you can save the file:
%save foo.py 42
kindall
source share