Hi! I want to process corresponding elements of two lists, sequentially. Call the lists list1 and list2, and assume they have equal lengths. I can do something like
for index in range(len(list1)): process(list1[index], list2[index]) But I find it somehow rather ugly, because we generate yet another an list for the index, when we already have the two we want to process. I know we can use xrange, but still I find it awkward... Instead of the above snippet, I am considering something like while list1: process(list1.pop(), list2.pop()) But this has the side effect of emptying both lists, which may not be convenient. Of course we can make backup copies of the lists if needed, but we are then recovering the previous method ugliness... Do you guys have any suggestions regarding this? Thanks Jose Amoreira _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor