Did you read the sentence that I wrote?

izip(count(), someArray) does the indexes.

On Wed, May 20, 2009 at 7:32 AM, Rupert Bates <[email protected]> wrote:
>
> Thanks for the reply, so that answers the alternate rows case, but
> there are plenty of other cases where you would want to know the index
> of the item. The items() solution feels like a bit of a workaround and
> presumably has performance implications. Would a mapi function not be
> more efficient and elegant? Sorry if I'm missing something.
> Rupert
>
> On May 19, 4:13 pm, Bob Ippolito <[email protected]> wrote:
>> Typically this is done with count or cycle and izip.
>>
>> izip(cycle(["odd", "even"]), someArray)
>>
>> On Tue, May 19, 2009 at 2:19 AM, Rupert Bates <[email protected]> wrote:
>>
>> > Hi there, how about adding a mapi function to Mochikit.Iter which
>> > passes the index of the item being processed to the specified
>> > function? It would be really handy, for instance for specifying
>> > altenate rows on a table.
>> > Rupert
>>
>>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to