[Chicago] Getting list of members of function in class

Bill Simons BSimons at geographix.com
Wed Mar 7 20:28:35 CET 2007


Not sure if what you're doing is a good idea, but this works for me:

A.dowork.im_func.func_code.co_names

-----Original Message-----
From: chicago-bounces at python.org [mailto:chicago-bounces at python.org] On
Behalf Of Lukasz Szybalski
Sent: Wednesday, March 07, 2007 12:20 PM
To: The Chicago Python Users Group
Subject: [Chicago] Getting list of members of function in class


Hello,
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? I could use dir(A) to get 'dowork', but that
similar thing doesn't get me the next list, dir(A.dowork)

Any help is appreciated,
Thanks.
Lucas
_______________________________________________
Chicago mailing list
Chicago at python.org http://mail.python.org/mailman/listinfo/chicago


More information about the Chicago mailing list