How to get a Function object from a Frame object

Gigi gigi-s at bigfoot.com
Sun Apr 17 18:40:58 EDT 2005


Hi,
I need access to a function object that corresponds to a frame object in 
a certain case from inside the function.

I can get the frame object using:

f = sys._getframe(0)

But the resulting frame object doesn't contain the information I need. 
There is a lot of information in the code object (f.f_code), but not the 
     actual function or method object.

The inspect module doesn't help either it just provides nicer interface 
to the Frame object.

Any ideas out there?

Thanks, Gigi




More information about the Python-list mailing list