News for hackers. Stuff that matters.
Re:Anecdotally, Programmers Dislike "Reduce" by vhcr on Wednesday September 16, 2026 @11:14PM (#49735993)
The problem with:

    ret = ""
    for s in strings:
        ret += s
is that it re-allocates O(n) times, even if ret is referenced only once.
Re:Anecdotally, Programmers Dislike "Reduce" by edflsafoiewq on Wednesday September 16, 2026 @11:46PM (#49736152)
If the s are small the usual geometric buffer growth mitigates that. Of course you can compute the final buffer size in this case, but often you have a bunch of dynamically-generated strings of different sizes.