Python Interview Questions

Steven Bethard steven.bethard at gmail.com
Wed Oct 31 10:43:18 EDT 2007


konryd wrote:
>> - string building...do they use "+=" or do they build a list
>>    and use .join() to recombine them efficiently
> 
> 
> I'm not dead sure about that, but I heard recently that python's been
> optimized for that behaviour. That means: using += is almost as fast
> as joining list.

For some simple cases, this is true.  But it only works in CPython, not 
say Jython.  So it's a better practice to continue using .join().

STeVe



More information about the Python-list mailing list