8000 Update sum comment. (#18240) · python/cpython@abb9a44 · GitHub
[go: up one dir, main page]

Skip to content

Commit abb9a44

Browse files
authored
Update sum comment. (#18240)
1 parent 4d96b46 commit abb9a44

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Python/bltinmodule.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2440,7 +2440,11 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
24402440
empty = []
24412441
sum([[x] for x in range(10)], empty)
24422442
2443-
would change the value of empty. */
2443+
would change the value of empty. In fact, using
2444+
in-place addition rather that binary addition for
2445+
any of the steps introduces subtle behavior changes:
2446+
2447+
https://bugs.python.org/issue18305 */
24442448
temp = PyNumber_Add(result, item);
24452449
Py_DECREF(result);
24462450
Py_DECREF(item);

0 commit comments

Comments
 (0)
0