On 2006-10-16, Tim Chase <[EMAIL PROTECTED]> wrote:
> If you need it in a flat list, rather than as a list of
> chunk_size lists (which are handy for iterating over in many
> cases), there are ways of obtaining it, such as the hackish
>
> >>> sum([a[i::chunk_size] for i in range(chunk_size)], [])
> [1, 4, 7, 10, 2, 5, 8, 3, 6, 9]
>
> There are likely good recipes for flattening a list.  I just
> happen not to have any at my fingertips.

Actually, there isn't a good recipe in Python for flattening a
list. They all come out tasting like Circus Peanuts (Turkish
Delight for you non-Yanks).

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to