Quick nested loop syntax?

Terry Reedy tjreedy at udel.edu
Wed Nov 19 19:11:55 CET 2008


Johannes Bauer wrote:
> Hi group,
> 
> if I remember correctly, wasn't there a way to quickly iterate through
> nested loops? Something like
> 
> a = { "a", "b", "c" }
> b = { 4, 9, 13}
> for (x, y) in someoperator(a, b):
> 	print(x, y)

from itertools import product
a = { "a", "b", "c" }
b = { 4, 9, 13}
for (x, y) in product(a, b):
	print(x, y)




More information about the Python-list mailing list