For the times that a list comprehension just won't do
for x in (1,2,3,4):print x;exec("for y in (5,6):print x,y;")
or
for s in Section.objects.all():exec("for j in s.children():print j")
Sometimes you can use itertools.product
(But there's no way to get the print x
) like this
for x, y in itertools.product((1,2,3,4), (5,6)):print x,y)