title: iter ,range in for loop python
body: <p>I thought the "for in" statement takes in iterables not iterators, but somehow the following codes works fine. I am confused. Actually, I was looking at the generator example at :
  <a href="https://www.python.org/dev/peps/pep-0289/" rel="nofollow noreferrer">https://www.python.org/dev/peps/pep-0289/</a></p>
  
  <pre><code>&gt;&gt;&gt; for i in range(10):
      print(i)
  
  
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
  &gt;&gt;&gt; for i in iter(range(10)):
      print(i)
  
  
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
  &gt;&gt;&gt;
  </code></pre>
  
  <p>Anyone can explain what happened when using iter(range(10)) in the for loop?</p>