Execution speed question

alex23 wuwei23 at gmail.com
Fri Jul 25 16:39:01 CEST 2008


On Jul 25, 9:54 pm, Jeff <jeffo... at gmail.com> wrote:
> Look at using reduce().  You can collect information about all of the
> nodes without necessarily building a large, intermediate list in the
> process.

From the OP's description, I assumed there'd be a list of all nodes,
from which he wishes to derive a 2nd list of specific nodes. reduce()
applies "a function of two arguments cumulatively to the items of a
sequence, from left to right, so as to reduce the sequence to a single
value", which doesn't seem to me to be what the OP was asking for. I
could understand using map() across the filter'd list, or embedding
the conditional check within the map'd function and ignoring filter(),
but at no point does the OP ask to perform any kind of function based
on two nodes...

I may have misunderstand your point, though :) Could you provide a
quick code sample to clarify?





More information about the Python-list mailing list