Cameron Laird wrote: ... > for hextuple in [(i, j, k, l, m, n) > for i in range(1, lim + 1) \ > for j in range (1, lim + 2) \ > for k in range (1, lim + 3) \ > for l in range (1, lim + 4) \ > for m in range (1, lim + 5) \ > for n in range (1, lim + 6)]: > print hextuple > > I don't think the list comprehension helps, in this case--although > it hints at the temptation of an eval-able expression which is > briefer. More on that, later.
from the recent "N-uples from list of lists" thread import cross for hextuple in cross(*[xrange(1, lim+p) for p in xrange(1, 7)]): print hextuple -- http://mail.python.org/mailman/listinfo/python-list