best way to replace first word in string?

S

Steven D'Aprano

Everything got faster, so it wasn't just pulling the chr conversion.

Sure -- I'm not concerned about proportional speed increases.
It's a 3Ghz P4.

Perhaps a tad faster, but not too much.
It's still in the buffer, and I copied it from your timings:



I'm runing Python 2.4.1 built with GCC 3.4.2.

There is a difference there:

http://www.python.org/doc/2.4/whatsnew/node12.html

Second-last paragraph:

String concatenations in statements of the form s = s + "abc" and s +=
"abc" are now performed more efficiently in certain circumstances. This
optimization won't be present in other Python implementations such as
Jython, so you shouldn't rely on it; using the join() method of strings is
still recommended when you want to efficiently glue a large number of
strings together. (Contributed by Armin Rigo.)
[end quote]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top