title: How to put statement before for-loop in python
body: <p>How can one put statement before for-loop in python? Such as:</p>
  
  <pre><code>print i for i in range(10)
  </code></pre>
  
  <p>The above example may seems unnecessary. But when it comes to a more complicated generator, it might be handy and pythonic:</p>
  
  <pre><code>print i for i in takewhile(lambda x: x &lt; 100000, fibonacci()) if i % 2 == 0
  </code></pre>
  
  <p>Of course the above statements would be complained by the interpreter. There should be some standard and simple way to do it, but I just can't find it. I know I can do something similar with list comprehension:</p>
  
  <pre><code>print [i for i in range(10)]
  </code></pre>
  
  <p>But it prints a list rather than every i in the list. Not exactly what I want.</p>