Jeremy Jones wrote: > Jeff Watkins wrote: > > > > > Using a KID template, I'd like to format a list of elements in a > > grid. For example: > > > > [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] > > > > rendered in a table as: > > > > .-----------. > > : 1 : 2 : 3 : > > :---+---+---: > > : 4 : 5 : 6 : > > :---+---+---: > > : 7 : 8 : 9 : > > '-----------' > > > > This would be simple using JSP or ASP, but I'm drawing a blank on how > > to do this in Kid. > > > > (Don't want to use templates, but that's life.) > > > I typically do it something like this: > > <?python > chunked_list = map(None, *[iter(some_list)]*2) > ?>
A really cool one-liner to partition any iterables. Though this is discussed over at c.l.py and condamned by the gurus that it is bad and has a very remote possibility that it may break in some future version of python.

