title: faster membership testing in python than set()
body: <p>I have to check presence of millions of elements (20-30 letters str) in the list containing 10-100k of those elements. Is there faster way of doing that in python than <code>set()</code> ?</p>
  
  <pre><code>import sys
  #load ids
  ids = set( x.strip() for x in open(idfile) )
  
  for line in sys.stdin:
      id=line.strip()
      if id in ids:
          #print fastq
          print id
          #update ids
          ids.remove( id )
  </code></pre>