Mike Meyer <[EMAIL PROTECTED]> writes: > data_out = [[] for _ in data_in] > ... > But I'm curious - what's the difference between the "foreach" you have > in mind and the standard python "for"?
The "for" loop, like the list comprehension, pollutes the namespace with an index variable that's not used for anything. I prefer genexps: data_out = list([] for x in data_in) -- http://mail.python.org/mailman/listinfo/python-list