Getting source code from interpreter-defined function

Michele Simionato mis6 at
Fri Apr 11 21:40:03 CEST 2003

"POYEN OP Olivier (DCL)" <Olivier.POYEN at> wrote in message news:<mailman.1050055156.23007.python-list at>...
> Hi all,
> I'm playing with inspect module, which, BTW, is great for finding useful =
> info on saved object, written object.
> With inspect, I can get source code from a function.
> Is there anyway I could do the same with "alive" object, without having =
> to wrap the whole python interpreter and create tmpfile for writing =
> session ? (an "alive" object would be an object defined at the =
> interpreter prompt)

This thread maybe of interest to you:

In short, you cannot extract the source from live objects; you can
decompile the bytecode, though, by using the decompyle module.


More information about the Python-list mailing list