From: Daneel Yaitskov on 6 May 2010 00:40 Hi, Everybody knows class's __str__ and __repr__ can be used to get readable user representation of an object. But for simple classes or debug aims it is tediously to code these methods. And Python has very powerful reflection. I believe that somebody has already written such library with this method. I search library which can universally print state all not callable attributes of an object. If object's attribute isn't int and float and string and boolean and none then the method calls itself recursively. Does this library exist? Daneel Yaitskov.
From: Lie Ryan on 7 May 2010 22:48 On 05/06/10 14:40, Daneel Yaitskov wrote: > Hi, > > > > Everybody knows class's __str__ and __repr__ can be used to get readable > user representation of an object. > > > But for simple classes or debug aims it is tediously to code these > methods. And Python has very powerful reflection. I believe that > somebody has already written such library with this method. > > I search library which can universally print state all not callable > attributes of an object. If object's attribute isn't int and float and > string and boolean and none then the method calls itself recursively. does dir() or printing __dict__ works for you?
|
Pages: 1 Prev: PyCon Australia Early-Bird running out! Next: ctypes:Multiple library access problem |