I have a question about list comprehension. Is there any possibility of making a list of comprehensions on a nested loop?
And how would it be the structure?
What do you mean? Answer is probably yes but always consider readability.
list1 = [1, 2, 3] list2 = ['a', 'b', 'c'] pairs = [(x, y) for x in list1 for y in list2]
is legal python.
Any further nesting might be tough to read.
list1 = [1, 2, 3] list2 = ['a', 'b', 'c'] for i in range(n): list1 = someTransformationFoo(list1, i) list1 = someTransformationBar(list2, j) for j in range(m): result = [(x, y) for x in list1 for y in list2] process(result)