In message <77as23f1fhj3...@mid.uni-berlin.de>, Diez B. Roggisch wrote:
>> But reduce()? I can't see how you can parallelize reduce(). By its >> nature, it has to run sequentially: it can't operate on the nth item >> until it is operated on the (n-1)th item. > > That depends on the operation in question. Addition for example would > work. My math-skills are a bit too rusty to qualify the exact nature of > the operation, commutativity springs to my mind. Associativity: ((A op B) op C) = (A op (B op C)) So for example A op B op C op D could be grouped into (A op B) op (C op D) and the two parenthesized subexpressions evaluated concurrently. But this would only give you a speedup that was logarithmic in the number of op's. -- http://mail.python.org/mailman/listinfo/python-list