split an iteration

Peter Otten __peter__ at web.de
Thu Mar 31 13:30:32 EST 2005


Robin Becker wrote:

> Is there a fast way to get enumerate to operate over a slice of an
> iterable?

I think you don't need that here:

e = enumerate(active_nodes)
for insert_index, a in e:
    # ...

for index, a in e:
    # ...

Peter




More information about the Python-list mailing list