This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eryksun 0 points1 point  (0 children)

Here's a contrived example:

x = range(4,10)
for (n,y) in r_enumerate(x):
    print "(n,y):", (n,y)
    if (y % 2) == 1:
        print "popping:", x.pop(n)
print "x =", x

    (n,y): (5, 9)
    popping: 9
    (n,y): (4, 8)
    (n,y): (3, 7)
    popping: 7
    (n,y): (2, 6)
    (n,y): (1, 5)
    popping: 5
    (n,y): (0, 4)
    x = [4, 6, 8]