[EMAIL PROTECTED] wrote: > John> Sorry, Skip, but I find that very hard to believe. The foo() > John> function would take quadratic time if it were merely adding on > John> pieces of constant size -- however len(str(i)) is not a constant, > John> it is O(log10(i)), so the time should be > John> super-quadratic. > > Sorry, I should have pointed out that I'm using the latest version of > Python. I believe += for strings has been optimized to simply extend s when > there is only a single reference to it.
I'd heard that, but wasn't sure. That's the kind of answer I was looking for. That kind of optimization is a huge win. John Nagle -- http://mail.python.org/mailman/listinfo/python-list