[Python-Dev] Re: Re: __pycode__ extension

Fernando Perez fperez528 at yahoo.com
Wed Nov 17 22:35:31 CET 2004


Phillip J. Eby wrote:

> If I understand correctly, this is unrelated.  The OP was about retaining
> source of functions defined in interactive mode, not the source of
> functions from files.  'os.path.walk' was obviously not typed in using
> interactive mode.  :)

OK, my misunderstanding.  You are right, and inspect does NOT seem to provide a
way to access the source of interactively defined functions (at least not that
I've seen):

In [6]: def foo(x):
   ...:     print x
   ...:

In [7]: psource foo
No source found for foo

Sorry for the confusion.

best,

f



More information about the Python-Dev mailing list