recursive converting object to string which hasn't __str__ or/and__repr__

Lie Ryan lie.1296 at gmail.com
Fri May 7 22:48:23 EDT 2010


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?



More information about the Python-list mailing list