To Reduce or Not To Reduce

Tim Peters tim_one at
Sat Feb 26 01:30:01 EST 2000

[Gerrit Holl]
> I thought I finally understood reduce, but apparantly, I don't.
> ...
> What am I missing? When should I use reduce?

We went thru this on the Edu-SIG not long ago:  never.  I wasn't joking.
reduce is virtually useless in Python, almost always both slower and more
obscure than the obvious alternatives.  You're not going to stumble into the
cases where it's faster without becoming an expert in the internals of the
implementation, but I won't spoil the fun of discovery for you <wink>.

even-metaclasses-may-be-more-useful<wink>-ly y'rs  - tim

More information about the Python-list mailing list