Sorry if this has been brought up before, I tried searching...
Would it be too complex/controller-y/confusing to allow sequence unpacking in Django's for loops? As far as I can tell it isn't supported. So for example, if I have a list... fruits = [('apple', 10), ('orange', 5), ('banana', 7)] ...as far as I know the only way to access both items is like so: {% for item in fruits %} You have {{ item.1 }} {{ item.0 }}{{ item.1|pluralize }}. {% endfor %} Using a dictionary instead makes things a little prettier: fruits = [{'name': 'apple', 'count': 10}, ...] {% for item in fruits %} You have {{ item.count }} {{ item.name }}{{ item.count|pluralize }}. {% endfor %} ...but in my mind this looks familiar and isn't too crazy for designers: {% for name,count in fruits %} You have {{ count }} {{ name }}{{ count|pluralize }}. {% endfor %} In my opinion that's not doing too much logic to be available in template processing. Also, I think the syntax can remain simple, maybe disallow parentheses, no space around the commas? Too much for template designers? Use a dictionary instead? What do you guys think? I'll write a patch if there's any interest... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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-users?hl=en -~----------~----~----~----~------~----~------~--~---