Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit abb9a44

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

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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)