I iterate over a Sublist (A). A has a defined lenght. Then, i extend another list (B) with the values of (A). For some reason, the first sublist (A) gets extended by the value i extend the other list (B) by.
I have absolutly no idea why this would happen and I'd be very thankfull for help regarding this issue.
combinations_list = [[[[1, 0], [], -3], [[0, 2], [], -3], [[2, 1], [], -3], [[0, 3], [], -3]]]
for A in combinations_list:
B = []
for i in range(len(A)):
for element in A[i][0]:
if B == []:
B.extend(A[i])
else:
if element in B[0]:
for e in A[i][0]: #Endless loop, A[i][0] gets extended by value of e
B[0].extend([e])