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

Fredrik Lundh fredrik at pythonware.com
Fri Oct 6 08:38:24 CEST 2006

Steve Holden wrote:

> instance.method(*args) <==> type.method(instance, *args)
> You can nowadays spell this as str.join("", lst) - no need to import a 
> whole module!

except that str.join isn't polymorphic:

 >>> str.join(u",", ["1", "2", "3"])
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: descriptor 'join' requires a 'str' object but received a 
 >>> string.join(["1", "2", "3"], u",")


More information about the Python-Dev mailing list