Hi everyone I am sorry if this is a noob question but I am using python and I have an issue where I copy an array but then when I modify the copy it affects the original. I
This is one of the most surprising things about Python - the =
operator never makes a copy of anything! It simply attaches a new name to an existing object.
If you want to make a copy of a list, you can use a slice of the list; the slicing operator does make a copy.
toAdd=xyzCoord[i][:]
You can also use copy
or deepcopy
from the copy module to make a copy of an object.