frames and classes
Alex Martelli
aleaxit at yahoo.com
Fri Nov 17 18:25:59 EST 2000
"Gil Hauer" <gilh at sympatico.ca> wrote in message
news:8v426v$hkv$1 at news.tht.net...
> Hi,
>
> I have a routine that is called as a result of the sys.settrace()
function.
> One of the parameters is the call frame. I would like to know that name of
> the class to which the function being traced belongs -- is there any way
to
> do this?
I was looking for something similar recently and couldn't
solve it in a fully reliable way. You can get the name of
the class of 'self' (assuming the convention of naming the
first parameter that way is respected -- or, of the first
parameter, at least!), but that is no guarantee -- the method
could be inherited, or explicitly delegated to. Or, of course,
it could not be a method at all (not belong to any class).
I suspect the only solution will need some rooting through
the bytecode...
Alex
More information about the Python-list
mailing list