Samir Mishra wrote at 2003-5-20 11:17 +0400:
.... But how do I enumerate all attributes & methods associated with an object when I don't know the structure of the object (i.e., as if I was exploring the object in a debugger)?
Look at Python's "inspect" module. It provides methods to inspect classes, instances, ...
.... I've been using Dieter Maurer's DocFinderEverywhere extensively to get info on generic objects returned by Zope (thanks Dieter, very helpful product, especially for beginners), but obviously it has it's limitations.
Only "DocFinder" is from me, the "*EveryWhere" is from Stefan.
Thanks again. SM.
-----Original Message----- From: Troy Farrell [mailto:troy@entheossoft.com] Sent: Tuesday, May 20, 2003 08:40 To: Samir Mishra Cc: 'zope@zope.org' Subject: Re: [Zope] Examining Properties of Returned Object
What is calling your python script? Is it TAL(ES), DTML, another python script, a zope product or an external method? Unfortunately, each of these has some slightly different methods... Did you try
obj.myattribute
or
getattr(obj, myattribute)
or (in TAL)
obj/myattribute
Thanks. Troy
Samir Mishra wrote:
Hello all,
I'm sure there's a way, just can't figure it out...
I have a python script returning an object. The result set I'm actually interested in is wrapped somewhere within this object.
My question: how can I examine the properties/methods of an object returned by Python?
Thanks in advance.
Regards, Samir
Dieter