Peter Otten wrote:
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


I tried your solution, but I think we miss the split element

eg for
>>> e = enumerate([0,1,2,3,4,5])
>>> for i,a in e:
...     if a==3: break
...
>>> for i,a in e:
...     print i,a
...
4 4
5 5
>>>

I think the second loop needs to start at 3 ie the split needs to be start, limit semantics

It would be nice to be able to fix it with a move back method.
--
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to