title: Why is integer returnvalue of function not interpreted the same as that integer
body: <p>Why does this work?</p>
  <pre><code>def nextSquare():
      i = 1;
  
      # An Infinite loop to generate squares
      while True:
          yield i*i
          i += 1  # Next execution resumes
                  # from this point
  
  # Driver code to test above generator
  # function
  for num in nextSquare():
      if num &gt; 100:
          break
      print(num)
  </code></pre>
  <p>But not this?</p>
  <pre><code>def nextSquare():
      i = 1;
  
      # An Infinite loop to generate squares
      while True:
          yield i*i
          i += 1  # Next execution resumes
                  # from this point
  
  # Driver code to test above generator
  # function
  for num in 1:
      if num &gt; 100:
          break
      print(num)
  </code></pre>
  <p>An integer is returned each time nextsquare is run so what is the difference between the first time nextsquare returns in</p>
  <pre><code>for num in nextSquare():
  </code></pre>
  <p>and</p>
  <pre><code>for num in 1:
  </code></pre>