I am trying to generate a list of lambda functions by converting strings to a list. For some reason, they all point to the last function which was created.
a = [y for y in input().split(',')]
b = []
for i in a:
b.append(lambda x: eval(i))
I saw there were answers for that question, suggesting to use an auxiliary function, but I want to avoid it. How can it be done, and why is it happening?