Closed ghost closed 5 years ago
When working in the terminal
Do you mean that you type the lines in right at the terminal? In that cases, indeed, Python is not able to get the source code for these lines. Nothing we can do about that, unfortunately.
Everything works well when using dill
from dill.source import getsource print(getsource(foo))
Ah, I read over that bit. That's interesting. Seems to be due to this. I'm not very enthusiastic about adding dill (or readline) as a dependency. Though maybe we can add terminal support (using readline as an optional dependency) using a littlebit of custom code that we extract from that dill module...
Made #28 to describe and track the potential enhancement. Thanks!
When working in the terminal with the following code, an error occurs:
When studying, it becomes clear that
inspect.getsource(foo)
gives an error when working in the terminal. But if you use the module dill then everything is ok.