[Python-Dev] Optimized string concatenation
Brett C.
bac at OCF.Berkeley.EDU
Sun Aug 8 23:46:37 CEST 2004
Nick Coghlan wrote:
> Adam Souzis wrote:
>
>> As someone relatively new to python, it struck me as a language wart
>> that i had to learn the form '"".join() as the proper way to do string
>> concatenation. It violates the principles of OOWTI and its certainly
>> not the obvious way to do string concatenation. This patch does not
>> cover all the cases so we're still stuck with join(), but as long as
>> it is not a documentated "feature" it will harmlessly improve the
>> performance of countless lines of code where the coder is either
>> untrained or too lazy to use join(). If its documented it'd just
>> muddy the waters vis a vis join(), besides the issues with other
>> Python implementation mentioned here.
>
>
> If I understand correctly, you're suggesting that ''.join(strings)
> continue to be the recommended, portable, non-quadratic method for
> concatenating strings.
>
I think the "portable" label is a little misleading. It isn't like
using string concatenation now is non-portable, it's just slow.
The other labels are correct, though.
-Brett
More information about the Python-Dev
mailing list