Is there a way to find out where a method is defined?
While browsing through Zope and product Python source code, I often see a method being called on an object and want to find out what it's doing and look up the definition. Because Zope objects often have many superclasses, I end up scanning through many class definitions. (My most recent experience was finally finding the definition of this() in the Item class, and saying, oh yes, that's correct, it doesn't do anything :-) And, there's always a danger that I'll miss a definition in a subclass or a superclass that gets inherited first, and be looking at the wrong method definition for the particular object. Is there a way in the runtime or in the debugger, perhaps through the magic of Python reflection, to ask "when I call this method on this object, this is the class providing the definition?"
On Sat, 05 Feb 2000 09:55:07 -0500, Andrew Wilcox <circle@gwi.net> wrote:
Is there a way in the runtime or in the debugger, perhaps through the magic of Python reflection, to ask "when I call this method on this object, this is the class providing the definition?"
It might not be the most convenient way, but you can get an accurate answer using the Monitor....... Welcome to <secure_monitor_channel connected 127.0.0.1:1669 at f1fe30> [Hint: try 'from __main__ import *']
import Zope z=Zope.app() z.zc.manage_delObjects.im_func.func_code
2000-02-07T07:57:47 INFO(0) ZServer <code object manage_delO bjects at ac77d0, file "D:\zope2\lib\python\OFS\ObjectManage r.py", line 373>
Toby Dickenson tdickenson@geminidataloggers.com
participants (2)
-
Andrew Wilcox -
Toby Dickenson