def auto_str(cls):

    def __str__(self):
        return '%s(%s)' % (type(self).__name__, ', '.join('%s=%s' % item for
            item in list(vars(self).items())))
cls.__str__ = __str__
return cls


@auto_str
class Foo(object):
    pass
Is there a way to auto generate a __str__() implementation in python?