Here is what I tried:
quadrant = [lambda x, y: (sign[0] * x, sign[1] * y)
for sign in ((1, -1), (1, 1), (-1, 1), (-1, -1))]
What I expected to get from this line was a list of functions that each return the input values with some set of signs applied. For example, quadrant[1](x, y) -> (x, y), quadrant[2](x, y) -> (-x, y), and so on.
What I actually got is a list of four identical functions, all the last function that I put into the list. For example, quadrant[1](x, y) -> (-x, -y), quadrant[2](x, y) -> (-x, -y), and so on.
What am I misunderstanding here? Why does each new function added to the list replace all the previously added functions?