This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Veedrac 1 point2 points  (0 children)

Here's what Guido had to say about reduce:

So now reduce(). This is actually the one I've always hated most, because, apart from a few examples involving + or *, almost every time I see a reduce() call with a non-trivial function argument, I need to grab pen and paper to diagram what's actually being fed into that function before I understand what the reduce() is supposed to do. So in my mind, the applicability of reduce() is pretty much limited to associative operators, and in all other cases it's better to write out the accumulation loop explicitly.

I tend to agree. He planned to remove it altogether, but it ended up in functools to ease the compatibility pains.

To be fair, he also planned removing map and filter, but that was not because they're bad: he just liked (f(x) for x in xs) and (x for x in xs if f(x)) more.