Friday, July 30, 2010

Re: Best way to present N items in table row for list

On 29 июл, 12:08, Roald de Vries <> wrote:

> First: list is a very unlucky name for a parameter, since it's the  
> type of []
> Second: list comprehension rules!
>      def groupListByRow(list):
>          return [lst[start:start+5] for start in range(0, len(lst), 5)]
> Cheers, Roald

Perfect!!!! This is why people use Python!!!! Simple, short, elegant

Finally i will use Roald's solution. The transformation in template
is possible, but not so clear.
Thanks to all for their help.

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment