[issue23049] Fix functools.reduce code equivalent.

2014-12-16 Thread Berker Peksag
Changes by Berker Peksag : -- stage: needs patch -> resolved ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue23049] Fix functools.reduce code equivalent.

2014-12-16 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue23049] Fix functools.reduce code equivalent.

2014-12-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0b3d69f15950 by Raymond Hettinger in branch '3.4': Issue #23049: Pure python equivalent shouldn't imply more exactitude than is really there. https://hg.python.org/cpython/rev/0b3d69f15950 -- nosy: +python-dev

[issue23049] Fix functools.reduce code equivalent.

2014-12-16 Thread Antoine Pitrou
Antoine Pitrou added the comment: I agree with Raymond. Examples in the code are not meant to be a reference but, well, examples. That is, the educational value should come first and strict adherence to the language spec only second. "Roughly equivalent" is already used in the functools doc, i

[issue23049] Fix functools.reduce code equivalent.

2014-12-14 Thread Raymond Hettinger
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

[issue23049] Fix functools.reduce code equivalent.

2014-12-14 Thread Terry J. Reedy
Terry J. Reedy added the comment: Background: the OP of #19202 proposed equivalent code for all the functool functions, including two versions for reduce. Georg combined the two versions into the one that Raymond pushed. Both agreed that reduce was the only function that really needed this.

[issue23049] Fix functools.reduce code equivalent.

2014-12-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it would be good to add Python implementation in functools.py and test they equivalence in tests. -- nosy: +serhiy.storchaka ___ Python tracker _

[issue23049] Fix functools.reduce code equivalent.

2014-12-13 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: docs@python -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list ma

[issue23049] Fix functools.reduce code equivalent.

2014-12-13 Thread Terry J. Reedy
New submission from Terry J. Reedy: from functools import reduce def add(a,b): return a+b reduce(add, {}) >>> Traceback (most recent call last): File "C:\Programs\Python34\tem.py", line 3, in reduce(add, {}) TypeError: reduce() of empty sequence with no initial value However, the reduce-e