So, I am playing around with Python trying to learn how to use it and I discovered something odd. My code is:
list1 = range(0, 2)
list2 = range(2, 4)
comb = list1, list2
print comb
print list1
list1.append(list2)
print comb
print list1
the outputs are:
print comb --- ([0, 1], [2, 3])
print list1 --- [0, 1]
print comb --- ([0, 1, [2, 3]], [2, 3])
print list1 --- [0, 1, [2, 3]]
What seem to be happening is I am combining my two lists, which works fine. But when I append list2 into list1 and re-print my comb list, the comb list has been updated with the newly appended list1.
What am I missing? Why does comb change when it has not been recalculated since the appending of list1?