[Python-ideas] Add nullifier argument to functools.reduce?

Devin Jeanpierre jeanpierreda at gmail.com
Sat Aug 23 17:47:22 CEST 2014


On Sat, Aug 23, 2014 at 8:30 AM, Warren Weckesser
<warren.weckesser at gmail.com> wrote:
> The argument would allow reduce to "short circuit" its calculation.   When
> reduce encounters the nullifier, it can return immediately.  This can
> provide
> a significant improvement in performance in some cases.

If you want something like this you should probably use an explicit
loop. And I say that as someone who *likes* reduce. Loops are far more
flexible. That said, I guess I am +0.

Does this feature exist in any other programming languages?

-- Devin


More information about the Python-ideas mailing list