[docs] [issue23049] Fix functools.reduce code equivalent.

Raymond Hettinger report at bugs.python.org
Mon Dec 15 03:26:35 CET 2014


Raymond Hettinger added the comment:

Elsewhere I have used "rough equivalent".

FWIW, the initializer defaulting to "None" is also an approximation.   It would be more technically correct to have "initializer = sentinel" where "sentinel = object()".   But of course this too would obfuscate the documentation which mainly aimed to clarify two sticky points:  1) the order of arguments to the function call (accm, x) vs (x, accm) and 2) that if an initializer isn't specified, the first value from the iterable is used.  These are the two issues that Guido found difficult to remember and caused reduce() to be banished from builtins.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23049>
_______________________________________


More information about the docs mailing list