This problem has been getting at me for a while now. Is there an easier way to write nested for loops in python? For example if my code went something like this
From your code it looks like you want to perform an operation with every possible pair of points where x and y are in the range 0..2.
To do that:
for x1,y1,x2,y2 in itertools.product(range(3), repeat=4):
do_something_with_two_points(x1,y1,2,y2)
The operation do_something_with_two_points will be called 81 times - once for every possible combination of points.