[Python-ideas] Rehabilating reduce (as "fold")

Barry Warsaw barry at python.org
Fri Jul 12 16:54:49 CEST 2013


On Jul 12, 2013, at 04:01 PM, Nick Coghlan wrote:

>I'd personally be in favour of the notion of also allowing strings as the
>first argument, so you could instead write:
>
>    data = fold("+=", [], iterables)

You had me until here...

>(Independent of this idea, it would actually be nice if the operator module
>had a dictionary mapping from op symbols to names, like
>operator.by_symbol["+="] giving operator.iadd)

...but this is a neat idea.

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130712/b60ff397/attachment.pgp>


More information about the Python-ideas mailing list