[Chicago] Getting list of members of function in class
Martin Maney
maney at two14.net
Wed Mar 7 20:41:22 CET 2007
On Wed, Mar 07, 2007 at 01:19:47PM -0600, Lukasz Szybalski wrote:
> I am trying to get a list of members of a function, namely:
>
> class A:
> def dowork(self):
> name='Lucas'
> work=['aaa','bbb']
> work1=[]
> work2=[]
>
> How can i get a list of items that were created in dowork, namely:
> name,work,work1,work2?
As written (is this a typo?) those four are local variables of the
function, and are freed when dowork exits. If they're supposed to be
self.name, etc., then they will be added to the object, and you could
do something like
a = A()
a.dowork()
print a.__dict__
Or just >>> a.__dict__ in the interpreter to examine the object.
--
Hebb's dictum: If it isn't worth doing, it isn't worth doing well.
More information about the Chicago
mailing list