title: Outputs from generator/iterator is gone after a for loop
body: <p>Below I have some code:</p>
  <pre><code>class Boy:
  
      def __init__(self,height,weight,limit):
          self.height = height
          self.weight = weight
          self.limit = limit
          self.count = 0
  
      def __iter__(self):
          return self
  
      def __next__(self):
          if self.count == self.limit:
              print( 'Reached the limit')
              raise StopIteration
          current = self.count
          self.count += 1
          print( f'Iter {current}')
          return 'Hey'
  
  </code></pre>
  <p>And if I do the following:</p>
  <pre><code>boy = Boy('140cm','25kg',limit=10)
  
  for hey in boy:
      print(boy)
  </code></pre>
  <p>The code above will output:</p>
  <pre><code>Iter 0
  Hey
  Iter 1
  Hey
  Iter 2
  Hey
  Iter 3
  Hey
  Iter 4
  Hey
  Iter 5
  Hey
  Iter 6
  Hey
  Iter 7
  Hey
  Iter 8
  Hey
  Iter 9
  Hey
  Reached the limit
  
  </code></pre>
  <p>But now if I add some code bellow (to collect all the 'Hey' in a list)</p>
  <pre><code>boy = Boy('140cm','25kg',limit=10)
  
  for hey in boy:
      print(boy)
  
  boy_output = list(boy)
  print(boy_output)
  </code></pre>
  <p>Now this code will output:</p>
  <pre><code>Iter 0
  Hey
  Iter 1
  Hey
  Iter 2
  Hey
  Iter 3
  Hey
  Iter 4
  Hey
  Iter 5
  Hey
  Iter 6
  Hey
  Iter 7
  Hey
  Iter 8
  Hey
  Iter 9
  Hey
  Reached the limit
  Reached the limit 
  []
  </code></pre>
  <p>Notice that the list is empty. But why? Is is because I ran a for loop? Is is something wrong with the instance once I ran a for loop? Or is it that I don't understand how custom iterators works?</p>
  <p>The same thing if I did the opposite(storing the outputs first, then printing out the Heys and the output of the function. Which results in the function not printing out Hey, but the Heys are stored in the list):</p>
  <pre><code>Iter 0
  Iter 1
  Iter 2
  Iter 3
  Iter 4
  Iter 5
  Iter 6
  Iter 7
  Iter 8
  Iter 9
  Reached the limit
  ['Hey', 'Hey', 'Hey', 'Hey', 'Hey', 'Hey', 'Hey', 'Hey', 'Hey', 'Hey']
  Reached the limit
  </code></pre>
  <p>What I want is to get the Heys from the instance(boy) and storing the Heys in a list(by collecting the output from the instance) at the same time</p>
  <p>I think there is something wrong with the instance <code>boy</code>, so are there anyway to fix that instances so that I can print all the <code>Hey</code> and storing them at the same time?</p>
  <p>The same thing goes for generators.</p>
  <p>If anyone know how to solve the problem, pleas help me out. Thank you!</p>