classification
Title: Change to use str.join() instead of += when concatenating string
Type: enhancement Stage: resolved
Components: asyncio Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, serhiy.storchaka, ys19991, yselivanov, zach.ware
Priority: normal Keywords: patch

Created on 2020-07-08 16:56 by ys19991, last changed 2020-07-08 18:58 by yselivanov. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21398 closed ys19991, 2020-07-08 17:01
Messages (4)
msg373317 - (view) Author: Wansoo Kim (ys19991) * Date: 2020-07-08 16:56
https://bugs.python.org/issue41242

According to BPO-41242, it is better to use join than += when concatenating multiple strings.

https://github.com/python/cpython/blob/b26a0db8ea2de3a8a8e4b40e69fc8642c7d7cb68/Lib/asyncio/queues.py#L82

However, the link above uses += in the same pattern. I think we'd better change this to `str.join()`
msg373319 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2020-07-08 17:03
That is not performance-critical code, and in that case it is clearer to use `+=` than str.join.

Closing the issue; Andrew or Yury can of course reopen it if they disagree with my assessment.
msg373321 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-07-08 17:12
Changes in bpo-41242 were rejected not because the new code is worse, but because it is not obviously and significantly better that the existing code. Here status quo wins for the same reasons. This rule saves us from endless rewriting the code and allows to focus on important things.
msg373331 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2020-07-08 18:58
> Changes in bpo-41242 were rejected not because the new code is worse, but because it is not obviously and significantly better that the existing code. Here status quo wins for the same reasons. This rule saves us from endless rewriting the code and allows to focus on important things.

+1.
History
Date User Action Args
2020-07-08 18:58:38yselivanovsetmessages: + msg373331
2020-07-08 17:12:30serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg373321
2020-07-08 17:03:48zach.waresetstatus: open -> closed

nosy: + zach.ware
messages: + msg373319

resolution: wont fix
stage: patch review -> resolved
2020-07-08 17:01:28ys19991setkeywords: + patch
stage: patch review
pull_requests: + pull_request20546
2020-07-08 16:56:39ys19991create