Robin Becker wrote:
> 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 woul
Raymond Hettinger wrote:
[Robin Becker]
This function from texlib in oedipus.sf.net is a real cpu hog and I determined
to see if it could be optimized.
def add_active_node(self, active_nodes, node):
"""Add a node to the active node list.
The node is added so that the list of active nodes is
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 s
[Robin Becker]
> This function from texlib in oedipus.sf.net is a real cpu hog and I determined
> to see if it could be optimized.
>
> def add_active_node(self, active_nodes, node):
> """Add a node to the active node list.
> The node is added so that the list of active nodes is always
>
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
--
http://mail.python.org/mailman/listinfo/python-list
This function from texlib in oedipus.sf.net is a real cpu hog and I determined
to see if it could be optimized.
def add_active_node(self, active_nodes, node):
"""Add a node to the active node list.
The node is added so that the list of active nodes is always
sorted by line number, and