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

Antoine Pitrou antoine at python.org
Sun Aug 24 16:28:00 CEST 2014


Le 24/08/2014 00:24, Nick Coghlan a écrit :
> On 24 August 2014 01:30, Warren Weckesser <warren.weckesser at gmail.com> wrote:
>> I'd like to add an additional optional argument to functools.reduce.
>> The argument is the "nullifier" of the reducing operation.  It is a value
>> such that function(nullifier, anything) returns nullifier.  For example, if
>> function(x, y) computes x*y, the nullifier is 0.  If function(x, y) is
>> the intersection of the sets x and y, the nullifier is the empty set.
>
> When it comes to judging the usefulness of functional programming
> features these days, my first question is generally going to be "Does
> PyToolz offer this?"
>
> Grumblings about the name aside,

I suppose it's for functional whizkidz and cowboyz?

Regards

Antoine.




More information about the Python-ideas mailing list