title: Python: Fastest way to find a string in an enumeration
body: <p>Parsed the <a href="http://www.iana.org/assignments/language-subtag-registry" rel="nofollow noreferrer">IANA</a> subtag (see <a href="https://stackoverflow.com/q/12460634/1577343">Cascaded string split, pythonic way</a>) and made a list of 8600 tags:  </p>
  
  <pre><code>tags= ['aa',
         'ab',
         'ae',
         'af',
         'ak',
         'am',
         'an',
         'ar',
         # ...
  </code></pre>
  
  <p>I want to check for example <code>mytag="ro"</code> if is in the list:
  what is the fastest way to do that:</p>
  
  <p><strong>First solution:</strong></p>
  
  <pre><code>if mytag in tags:
      print "found"
  </code></pre>
  
  <p><strong>Second solution:</strong></p>
  
  <pre><code>if mytag in Set(tags):
      print "found"
  </code></pre>
  
  <p><strong>Third solution:</strong> Transform the list in a big string like: <code>'|aa|ab|ae|af|ak|am|an|ar|...'</code> and then see if string is in another string:</p>
  
  <pre><code>tags = '|aa|ab|ae|af|ak|am|an|ar|...'
  if mytag in tags:
      print "found"
  </code></pre>
  
  <p>Is there another way? Which is the fastest, is this already measured, if not how can I benchmark myself (shoul I take a random element from the list or should I take the last and then test it, can someone provide python code for a 'chronometer')? </p>