[Python-Dev] PATCH submitted: Speed up + for string concatenation, now as fast as "".join(x) idiom

Steve Holden steve at holdenweb.com
Fri Oct 6 08:35:19 CEST 2006

Gregory P. Smith wrote:
>>I've never liked the "".join([]) idiom for string concatenation; in my 
>>opinion it violates the principles "Beautiful is better than ugly." and 
>>"There should be one-- and preferably only one --obvious way to do it.". 
>>(And perhaps several others.)  To that end I've submitted patch #1569040 
>>to SourceForge:
>>This patch speeds up using + for string concatenation.
> yay!  i'm glad to see this.  i hate the "".join syntax.  i still write
> that as string.join()  [...]

instance.method(*args) <==> type.method(instance, *args)

You can nowadays spell this as str.join("", lst) - no need to import a 
whole module!

Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden

More information about the Python-Dev mailing list