Loop while checking if element in a list in Python : <p>Let's say I have a simple piece of code like this:</p>

<pre><code>for i in range(1000):
    if i in [150, 300, 500, 750]:
        print(i)
</code></pre>

<p>Does the list <code>[150, 300, 500, 750]</code> get created every iteration of the loop? Or can I assume that the interpreter (say, CPython 2.7) is smart enough to optimize this away?</p>
