Basic Model __repr__ implementation (issue #251)
authorinactivist <inactivist@gmail.com>
Thu, 14 Feb 2013 15:25:59 +0000 (07:25 -0800)
committerinactivist <inactivist@gmail.com>
Thu, 14 Feb 2013 15:25:59 +0000 (07:25 -0800)
tweepy/models.py

index fe87adb0779d56d2cf20878d1b649f539912c2d7..0039e3d137f9bffb8eebd6ea2d9c347bee5515a0 100644 (file)
@@ -39,6 +39,10 @@ class Model(object):
                 results.append(cls.parse(api, obj))
         return results
 
+    def model__repr__(self):
+        state = ['%s=%s' % (k, repr(v)) for (k,v) in vars(self).items()]
+        return '%s(%s)' % (self.__class__.__name__, ', '.join(state))
+
 
 class Status(Model):