title: Set with expiration not working inside running Python script
body: <p>I have this class called DecayingSet which is a deque with expiration</p>
  
  <pre><code>class DecayingSet:
      def __init__(self, timeout): # timeout in seconds
          from collections import deque
          self.timeout = timeout
          self.d = deque()
          self.present = set()
  
      def add(self, thing):
         # Return True if `thing` not already in set,
         # else return False.
          result = thing not in self.present
          if result:
            self.present.add(thing)
            self.d.append((time(), thing))
          self.clean()
          return result
  
      def clean(self):
         # forget stuff added &gt;= `timeout` seconds ago
         now = time()
         d = self.d
         while d and now - d[0][0] &gt;= self.timeout:
              _, thing = d.popleft()
              self.present.remove(thing)
  </code></pre>
  
  <p>I'm trying to use it inside a running script, that connects to a streaming api.
  The streaming api is returning urls that I am trying to put inside the deque to limit them from entering the next step of the program.</p>
  
  <pre><code>    class CustomStreamListener(tweepy.StreamListener):
           def on_status(self, status, include_entities=True):
               longUrl = status.entities['urls'][0]['expanded_url']
  
               limit = DecayingSet(86400)
               l = limit.add(longUrl)
               print l
               if l == False:
                pass
               else:
                r = requests.get("http://api.some.url/show?url=%s"% longUrl)
  </code></pre>
  
  <p>When i use this class in an interpreter, everything is good.
  But when the script is running, and I repeatedly send in the same url, l returns True every time indicating that the url is not inside the set, when is supposed to be. What gives?</p>