Mark Harrison wrote:
Is there a way to automatically print all the instance
data in a class? This is for debugging, I would like
to do something like dump(self) to snapshot the state
of the object.
def dump(obj):
buf = ['%r %s :' % (obj, str(obj)]
for name in dir(obj):
attr = getattr(obj, name)
if not callable(attr):
buf.append["- %s : %s" % (name, str(attr))]
return '\n'.join(buf)
Not tested...
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"