I have function 1 ma_generate which generates a list of numbers called ma_list, with one of the inputs being period.
I have function 2 multi_gen which iterates function 1 four times, each time with a different value of time. Each time function 1 is iterated, a list list1 (or list2, list3, list4 depending on which iteration) is set to equal the produced ma_list. So the intended output is to have 4 different lists (list1, list2, list3, list4) which are different versions of ma_list, with the period input changing each of the 4 times.
Here is the code:
def ma_generate(dataset, method, period): ##Function 1
    ma_list.clear()
    if method == "sma":
        for i in range(0,period-1):
            ma_list.append(0)
        for i in range(period-1,len(dataset)):
            ma = np.mean(dataset[i+1-period:i+1])
            ma_list.append(ma)
    return 
def multi_gen(dataset, method, p1, p2, p3, p4):
    ma_generate(dataset, method, p1)
    list1.append(ma_list)
    ma_generate(dataset, method, p2)
    list2.append(ma_list)
    ma_generate(dataset, method, p3)
    list3.append(ma_list)
    ma_generate(dataset, method, p4)
    list4.append(ma_list)
    return
However, all 4 of the generated lists are the same. They are all what "list4" should be. (the ma_list output of ma_generate when period = p4). Why are they the same?
 
     
    