Sammo <sammo2828 <at> gmail.com> writes:

> 
> String concatenation has been optimized since 2.3, so using += should
> be fairly fast.

This is implementation dependent and shouldn't be relied upon.

> 
> Note that I need to do something to mydata INSIDE the loop, so please
> don't tell me to append moredata to a list and then use "".join after
> the loop.

Then why not just mutate the list and then call "".join?

> 
> Why is the second test so much slower?

Probably several reasons:

1. Function call overhead is quite large compared to these simple operations.
2. You are resolving attribute names.




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to