title: argument of type 'bool' is not iterable
body: <p>I'm running this code, which is supposed to remove element that meet a certain requirement from a list while iterating through it:</p>
  
  <pre><code>linkList[:] = [link for link in linkList if "some string" in (self.visitedLinkDictionary[link] == 1) and (link.split('/')[2])]
  </code></pre>
  
  <p>I changed the code to that after reading the answers to <a href="https://stackoverflow.com/questions/1207406/remove-items-from-a-list-while-iterating-in-python">this</a> question.  Previous version was:</p>
  
  <pre><code>addNodes = 0
  for link in linkList:
      self.visitedLinkDictionary[link] += 1
      #control that the link has not been checked previously
      if self.visitedLinkDictionary[link] == 1:
          #control that the link belongs to the caltech domain
          checkDomain = link.split('/')
          if "some string" in checkDomain[2]:
              addedNodes += 1
          else:
              print "Not in 'some string' domain"
              del linkList[i]
      else:
          print "Duplicated hyperlink"
          del linkList[i]
      i += 1
  
  print addedNodes
  </code></pre>
  
  <p>What I'm trying to do is go through a list of strings and check if two conditions are met:</p>
  
  <ul>
  <li>First a given string should not be contained in the <code>self.visitedLinkDictionary</code></li>
  <li>Secondly it should contain the substring 'some string'</li>
  </ul>
  
  <p>Can anybody please tell me what I'm doing wrong in any/both of cases and eventual better ways to implement this code?</p>