Am 13.09.2014 09:22 schrieb Chris Angelico:
In that case, don't iterate over the list at all. Do something like this:while lst: element = lst.pop(0) # work with element lst.append(new_element)
And if you don't like that, define a def iter_pop(lst): while lst: yield lst.pop(0) and you can do for element in iter_pop(lst): # work with element lst.append(new_element) Thomas -- https://mail.python.org/mailman/listinfo/python-list