title: python for k, g in iterpools.groupby(str): list(g) will change in the 'if' statement
body: <p>As a newbie, I try to practice the function of groupby and see the result. However, I find a weird phenomenon。</p>
  
  <pre><code>    str = 'hieeelalaooo'
      for k, g in groupby(str):
          print(list(k), list(g))
          if True:
              print(list(k), list(g))
  </code></pre>
  
  <p>The result shows that list(g) will change in the 'if' statement like below:</p>
  
  <pre><code>`['h'] ['h']
   ['h'] []
   ['i'] ['i']
   ['i'] []
   ['e'] ['e', 'e', 'e']
   ['e'] []
   ....`
  </code></pre>
  
  <p>I just can't get it. In my intuition, list(g) should be unchanged rather than becoming a empty list. Could anyone please explain the underlying logic for such change? I am really appreciated for your help.</p>