On 2/17/07, oggie rob <[EMAIL PROTECTED]> wrote: > > > I find it useful to have the {% for %} tag syntax extended so that one can > > write: > > {% for a,b in L %} meaning the obvious thing
+1 > > You can do this. a,b return type is implicitly (a,b) in Python. In > other words: > {% for x in L %} > {{ x.0 }} > {{ x.1 }} > {% endfor %} well yes, but you have to admit that {% for name, description in list %} {{ name }} - {{ description }} {% endfor %} looks way better ;) just some syntax sugar, but I think it's actually useful > > > Also (maybe more contentious): > > {% for i in L1,L2 %} meaning what one would write in python as: > > for i in zip(L1,L2) +0 - I like this feature, but I didn't know when I first looked at it whether its a zip() or concatenation, that should be clear > > This is starting to look like more logic in the template than you > would normally use. I think the idea of the {% for %} tag has been > (and should be) to be able to easily cycle through collections of data > you've already set up. Most of the time you don't have to manipulate > them in any way other than how you've collected the data in the first > place. If you *DO* need to manipulate them, you should use views, not > templates. > > You can also write your own tag to do the same - however, I still > think the work should be done in the view. well, I can see a use case for this - if you want to iterate over multiple lists at a time... for example if you want to render something to columns rather that rows in a table, that's a change that shouldn't require a change to the view function, yet it is near impossible to achieve withou custom filters or tags... > > My .02 and mine ;) > -rob > > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---