May-05-2018, 02:56 PM
Lists and arrays are always passed as a reference if you do a simple assignment. But there is an easy way to solve this problem.
a = [1, 2, 3, 4] last = list(a)now a copy of list a is made and passed to last.
import numpy as np a = np.array([1,2,3,4]) last = a.copy()a copy is made of the array and then passed to last.