Getting attributes of a class
Try the inspect module. getmembers and the various tests should be helpful. EDIT: For example, class MyClass(object): a=”12″ b = ’34’ def myfunc(self): return self.a >>> import inspect >>> inspect.getmembers(MyClass, lambda a:not(inspect.isroutine(a))) [(‘__class__’, type), (‘__dict__’, <dictproxy {‘__dict__’: <attribute ‘__dict__’ of ‘MyClass’ objects>, ‘__doc__’: None, ‘__module__’: ‘__main__’, ‘__weakref__’: <attribute ‘__weakref__’ of ‘MyClass’ objects>, ‘a’: ’34’, ‘b’: … Read more