fast sub list operations

Tim Peters at
Thu Oct 18 04:41:28 CEST 2001

[mwh at]
> ...
> [0] Actually, this is obvious.  interleave1 is quadratic in list
> length, so maybe that's what's killing it, rather than the eval loop
> optimisations.  Remind me what reduce is doing in the language again?

reduce() came as part of the contributed code that also added lambda, filter
and map to Python 1.0.  I don't think I've seen a program using Python's
reduce() that wasn't made both faster and clearer by replacing it with a
loop; the same isn't true of filter and map; lambda can be argued either
way, but with the special twist that people arguing in favor of it are
usually thinking of some other language <wink>.

never-point-with-your-feet-it's-considered-impolite-ly y'rs  - tim

More information about the Python-list mailing list