On 5/19/10 12:11 PM, superpollo wrote:
In [39]: def f():
....: return 42
....:
In [40]: %psource f
No source found for f
In [41]:
i expected to see the source...
You will want to ask IPython questions on the IPython mailing list:
http://mail.scipy.org/mailman/listinfo/ipython-user
The reason you do not get the source is because there is no file that contains
functions defined in the interactive interpreter. %psource uses the inspect
module, and the inspect module explicitly only looks in real files using the
linecache module. IPython could be modified to inject fake files into the
linecache, but that's a chunk of work. I am sure they would be happy to
incorporate a patch if you were to provide it to them.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
--
http://mail.python.org/mailman/listinfo/python-list