
Oct. 25, 2003
8:20 p.m.
sum looks cooler, but it can be an order of magnitude slower than the humble loop of result.extend calls. We could fix this specific performance trap by specialcasing in sum those cases where the result has a += method -- hmmm... would a patch for this performance bug be accepted for 2.3.* ...? (I understand and approve that we're keen on avoiding adding functionality in any 2.3.*, but fixed-functionality performance enhancements should be just as ok as fixes to functionality bugs, right?)
No way. There's nothing that guarantees that a+=b has the same semantics as a+b, and in fact for lists it doesn't. I wouldn't even want this for 2.4. --Guido van Rossum (home page: http://www.python.org/~guido/)