On 2/18/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.

> >  Also (maybe more contentious):
> > {% for i in L1,L2 %} meaning what one would write in python as:
> > for i in zip(L1,L2)

Most people seem to be +0 on this, but I'm very much -1.

Firstly, the proposed syntax reads to me as 'iterate over concatenated
list', not 'iterate over zipped list'

Secondly, remember that one of the audiences of the template language
is designers with no programming experience. IMHO, adding operational
modes to template tags in this way only serves to complicate what
needs to be a simple interface.

However - I acknowledge the use case: Two lists, n items long, that
are from independent sources.  I think a separate template tag in the
same vein as {% regroup %}  would be a better approach.

{% zip lista listb as combined %}
{% for a,b in combined %}
...

This would be easier to explain, unambiguous, and doesn't pollute the
simplicity of the for tag.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to