Let's say I have a simple piece of code like this:
for i in range(1000):
if i in [150, 300, 500, 750]:
print(i)
Does the list [150, 300, 500, 750] 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?