[issue39440] Use PyNumber_InPlaceAdd in sum() for the second iteration onward

2020-01-28 Thread Brandt Bucher
Brandt Bucher added the comment: Perhaps. I've opened a PR to update the comment with more info. -- ___ Python tracker ___ ___

[issue39440] Use PyNumber_InPlaceAdd in sum() for the second iteration onward

2020-01-28 Thread Brandt Bucher
Change by Brandt Bucher : -- pull_requests: +17619 pull_request: https://github.com/python/cpython/pull/18240 ___ Python tracker ___

[issue39440] Use PyNumber_InPlaceAdd in sum() for the second iteration onward

2020-01-23 Thread edk
edk added the comment: It's not only sequences. But I didn't know this had come up before, sorry. Maybe the nature of the warning in the source code s a bit misleading? -- stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue39440] Use PyNumber_InPlaceAdd in sum() for the second iteration onward

2020-01-23 Thread Brandt Bucher
Change by Brandt Bucher : -- resolution: -> duplicate ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39440] Use PyNumber_InPlaceAdd in sum() for the second iteration onward

2020-01-23 Thread Brandt Bucher
Brandt Bucher added the comment: Prior discussion at https://bugs.python.org/issue18305. Note the final comment. In short, this is a breaking semantic change, and the general consensus is that using sum for sequence concatenation is an anti-pattern. -- nosy: +brandtbucher

[issue39440] Use PyNumber_InPlaceAdd in sum() for the second iteration onward

2020-01-23 Thread Ammar Askar
Change by Ammar Askar : -- keywords: +patch pull_requests: +17542 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18156 ___ Python tracker ___

[issue39440] Use PyNumber_InPlaceAdd in sum() for the second iteration onward

2020-01-23 Thread edk
New submission from edk : The C implementation of sum() contains this comment: /* It's tempting to use PyNumber_InPlaceAdd instead of PyNumber_Add here, to avoid quadratic running time when doing 'sum(list_of_lists, [])'. However, this would produce a