mirror of https://github.com/python/cpython
Update sum comment. (#18240)
This commit is contained in:
parent
4d96b4635a
commit
abb9a448de
|
@ -2440,7 +2440,11 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
|
||||||
empty = []
|
empty = []
|
||||||
sum([[x] for x in range(10)], empty)
|
sum([[x] for x in range(10)], empty)
|
||||||
|
|
||||||
would change the value of empty. */
|
would change the value of empty. In fact, using
|
||||||
|
in-place addition rather that binary addition for
|
||||||
|
any of the steps introduces subtle behavior changes:
|
||||||
|
|
||||||
|
https://bugs.python.org/issue18305 */
|
||||||
temp = PyNumber_Add(result, item);
|
temp = PyNumber_Add(result, item);
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
Py_DECREF(item);
|
Py_DECREF(item);
|
||||||
|
|
Loading…
Reference in New Issue