Display Function Code Body?

Robert Brewer fumanchu at amor.org
Fri Jan 7 16:15:49 EST 2005

Haibao Tang wrote:
> Hail Python pals! I played with the R (http://r-project.cran.org) last
> night to do some statistics and it has an interactive session too, and
> I found a feature that is quite useful.
> I found by actually typing a function name, the R gives you a 
> code body output.
> > f1 = function(x){x*x}
> > f1
> function(x){x*x}
> What I would like to do is to write a function like disp(), 
> when typed, it can give you the code infomation.
> >>> disp(f1)
> <function f1 at 0x00F522B0>
> def f1(x):
> return x*x
> <environment: interactive>

You can do this with lambdas with my LambdaDecompiler inside:
If you want to extend it to full functions, be my guest. ;)

There's also a commercial decompiler out there called "decompyle", and
they even have a web service. http://www.crazy-compilers.com/decompyle/

Robert Brewer
Amor Ministries
fumanchu at amor.org

More information about the Python-list mailing list