Optimize the Model pickling a bit.
authorJoshua <jroesslein@gmail.com>
Sat, 30 Jan 2010 15:58:51 +0000 (09:58 -0600)
committerJoshua <jroesslein@gmail.com>
Sat, 30 Jan 2010 15:58:51 +0000 (09:58 -0600)
tweepy/models.py

index dd02944a2e896f4778ce026264651b784ac96016..2e2bff0df99205f7b667ce2d36bbbac33908cf7c 100644 (file)
@@ -18,12 +18,8 @@ class Model(object):
 
     def __getstate__(self):
         # pickle
-        pickle = {}
-        for k, v in self.__dict__.items():
-            if k == '_api':
-                # do not pickle the api reference
-                continue
-            pickle[k] = v
+        pickle = dict(self.__dict__)
+        del pickle['_api']  # do not pickle the API reference
         return pickle
 
     @classmethod