Two speed/efficiency questions: 'For x in list' vs 'for x in xrange(len(list))', string matching with re vs ==
<p>Two questions about speed/efficiency/best practices in Python. Which of the following are 'better' (faster, less memory-intensive, etc.):</p>

<ol>
<li><p>&nbsp;</p>

<pre><code>for x in list:
    #do something to x
</code></pre>

<p>or</p>

<pre><code>for x in xrange(len(list)):
    #do something to list[x]
</code></pre></li>
<li><p>&nbsp;</p>

<pre><code>for string in list_of_strings:
    for string2 in other_string_list:
        if string == string2:
            #do something
</code></pre>

<p>or</p>

<pre><code>import re
for string in list_of_strings:
    if re.match('%s'%(string),other_strings): #or re.search(etc)
         #do something
</code></pre></li>
</ol>

<p>Not terribly pressing, I'm mostly just curious. I guess I could get some kind of raw data using timeit() or whatever, but I'd appreciate more depth than just "this one is faster than that one on your computer."</p>
