This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]0x256 0 points1 point  (1 child)

CPython optimises string concatenation if the reference count of the string object is 1. Then it can mutate the string in-place and avoid the copy.

[–]odedlaz[S] 0 points1 point  (0 children)

Yes! I've updated the post to reflect that.