On 30 Aug 2008, at 19:32, Bruce Leban wrote:
On Sat, Aug 30, 2008 at 10:56 AM, Arnaud Delobelle <email@example.com
Finally, my function works gracefully with nested loops:
for i, i_last in flaglast(items): for j, j_last in flaglast(jtems): ...
without the need for a 'named loop', about which I feel very circumspect.
Unfortunately, your function has to get the N+1st item before the body processes the Nth element so if getting the elements has side effects and the body might break, then this changes the behavior of the loop. With an explicit call to an <is this the last> function, we know exactly when it will peek ahead in the list.
How do you propose to find out if the item is the last without getting the next one?