PEP-xxx: Unification of for statement and list-comp syntax

Delaney, Timothy (Tim) tdelaney at avaya.com
Wed May 24 19:19:05 EDT 2006


Heiko Wundram wrote:

> Am Mittwoch 24 Mai 2006 06:12 schrieb Tim Roberts:
>> At one time, it was said that the "%" operator was the fastest way to
>> concatenate strings, because it was implemented in C, whereas the +
>> operator was interpreted.  However, as I recall, the difference was
>> hardly measurable, and may not even exist any longer.
> 
> The difference doesn't exist anymore for CPython (if you join a lot of
> strings)

Actually, the string concatenation optimisations only work in certain
specific cases (although they are the most common cases).

It is still definitely advised to append to a list, then join the list.

Tim Delaney



More information about the Python-list mailing list