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
That way looks pretty straightforward and easy. Are you are saying you want to generalize to multiple layers of loops.... can you give a real-life example?
Another option I could think of would be to use a function to generate the parameters and then just apply them in a loop
def generate_params(n):
return itertools.product(range(n), range(n))
for x,y in generate_params(3):
do_something()