title: Pythonic equivalent of unshift or redo?
body: <p>I'm learning Python, and I have a situation where I want to consume items from an iterator.  The tricky part is that under certain conditions, I want to "un-iterate."  That is, put an item back onto the front of the iterator before I loop.</p>
  
  <p>For example, suppose I'm picking apples from a tree.  My fruit basket can only hold 10kg before it needs to be emptied.  But I have to pick each apple before I can weigh it and determine if this apple would exceed the capacity of the basket.</p>
  
  <p>In a language like Perl, I could <code>unshift()</code> the apple back onto the tree, and then let the loop expression re-pick the apple:</p>
  
  <pre><code>while ($apple = shift(@tree)) {
    $wt = weight($apple);
    if ($wt + weight(@basket) &gt; 10) {
      send(@basket);
      @basket = ();
      unshift(@tree, $apple);
    } else {
      push(@basket, $element);
    }
  }
  </code></pre>
  
  <p>Or else I can also use <code>redo</code>, which resumes processing at the top of block, without evaluating the loop expression.  So the same apple can be re-processed, after the basket has been emptied.</p>
  
  <pre><code>while ($apple = shift(@tree)) {
    $wt = weight($apple);
    if ($wt + weight(@basket) &gt; 10) {
      send(@basket);
      @basket = ();
      redo;
    } else {
      push(@basket, $apple);
    }
  }
  </code></pre>
  
  <p>What would be the most <strong>pythonic</strong> solution for this kind of problem?</p>