Given a list A of any objects, I want to create another list B of lambda functions, where each B[i] () returns A[i]. For example,
B = [lambda: A[0], lambda: A[1], lambda: A[2], ...]
How can I do with for any arbitrary lengthed array A? Obviously, B = [lambda: element for element in A]
does not work. What is a workaround for this?