On Fri, 05 Jun 2009 11:37:49 -0700, Minesh Patel wrote: >> def chain(*args): >> return (item for seq in args for item in seq) >> >> for x in chain(list_a, list_b): >> foo(x) >> -- >> http://mail.python.org/mailman/listinfo/python-list >> >> > If they are the same length, you can try the zip built-in function.
Which does something *completely different* from what the Original Poster was asking for. Given alist = [1, 2, 3], blist = [4, 5, 6], the OP wants to process: 1, 2, 3, 4, 5, 6 but zip will give: (1, 3), (2, 5), (3, 6) -- Steven -- http://mail.python.org/mailman/listinfo/python-list