On Thu, May 28, 2009 at 9:03 AM, Masklinn <maskl...@masklinn.net> wrote:

>
> On 28 May 2009, at 15:30 , Alex Gaynor wrote:
> > On Thu, May 28, 2009 at 8:11 AM, Masklinn <maskl...@masklinn.net>
> > wrote:
> >
> >>
> >> On 28 mai 09, at 14:55, Jani Tiainen <rede...@gmail.com> wrote:
> >>> laspal kirjoitti:
> >>>> Hi,
> >>>> I have 2 list and want to iterate as one in template.
> >>>> How can I do it.
> >>>> example->
> >>>> list1 = [10,20,30,30]
> >>>> list2 = [aa,bb,cc,dd]
> >>>
> >>> combinedlist = ( (a[x],b[x]) for x in range(len(a)) )
> >>>>
> >>>>
> >> Reinventing zip (or, in this precise case, itertools.izip) might not
> >> be as simple as just using them though.
> >>
> >>>
> >>
> > I don't think he's looking for zip, it sounds like he wants
> > itertools.chain,
> >
> > from itertools import chain
> >>>> chain([1,2,3], [3,2,1])
> > [1,2,3,3,2,1]
>  From his initial example, it looks like zip more than chain, but in
> any case I was responding to Jani whose answer is a reimplementation
> of izip ;)
>
> >
> Oh, yeah, you're right that it looks more like zip.

Alex


-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to