Somehow after doing this
list2 = [x for x in range(10)]
list1 = [ x for x in range(10,20)]
for k, list1 in enumerate([list1,list2]):
for number, entry in enumerate(list1):
print number, entry
suddenly id(list2)==id(list1)
evaluated to True? What on earth is happening? while the loop is running this does not seem to bee the case the first output is as expected :
0 10, 1 11, 2 12,...0 0, 1 2, 2 3,...
the second though gives:
0 0, 1 1, 2 2...
How is this possible?
Simply changing the code to:
list2 = [x for x in range(10)]
list1 = [ x for x in range(10,20)]
Gets rid of this behaviour.
for k, NEWVAR in enumerate([list1,list2]):
for number, entry in enumerate(list1):
print number, entry