[csw-devel] SF.net SVN: opencsw:[593] twitter/sweets/sweets.py

skayser at users.sourceforge.net skayser at users.sourceforge.net
Wed Jan 11 23:20:38 CET 2012


Revision: 593
          http://opencsw.svn.sourceforge.net/opencsw/?rev=593&view=rev
Author:   skayser
Date:     2012-01-11 22:20:38 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
twitter/sweets: python not happy with the generator, list comprehension FTW

Modified Paths:
--------------
    twitter/sweets/sweets.py

Modified: twitter/sweets/sweets.py
===================================================================
--- twitter/sweets/sweets.py	2012-01-11 22:11:39 UTC (rev 592)
+++ twitter/sweets/sweets.py	2012-01-11 22:20:38 UTC (rev 593)
@@ -123,9 +123,7 @@
 
     def get_matching_tweets(self, string):
         """Get list of tweets where the tweet contains a given string."""
-        for tweet in self.get_tweets():
-            if tweet['text'].find(string) == -1: continue
-            else: yield tweet
+        return [ t for t in self.get_tweets() if t['text'].find(string) != -1 ]
 
 
 def twitter_search_mock(query="", state=""):

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list