I'm currently writing a python skript and I have an issue that a list is getting cleared if I clear another list.
elements is a list that is filled before
elements2 = elements
while len(elements2) > 0:
elements2.clear()
print(elements)
function(elements, elements2)
When i print elements the list is empty. This is critical because my function has a for-loop going through elements and putting some parts of the list in elements2 in some occasions so the funtion stops being declared only when all Parameters are set for it.
Why is elements cleared when I clear elements2 and how do i prevent it but still clear elements2?
Thanks in advance