On Tue, 29 Jan 2008 11:51:04 -0800 (PST) [EMAIL PROTECTED] wrote: > Any elegant way of breaking out of the outer for loop than below, I > seem to have come across something, but it escapes me > > for i in outerLoop: > for j in innerLoop: > if condition: > break > else: > continue > break
Ha! Think outside the box to begin with ... P. def cross(args): ans = [[]] for arg in args: ans = [x+[y] for x in ans for y in arg] return ans def test(): L = [[0,1,2]]*3 for a,b,c in cross(L): print a,b,c if __name__=='__main__': test() -- http://mail.python.org/mailman/listinfo/python-list