Pyhon 2.x or 3.x, which is faster?

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Mar 11 16:59:14 EST 2016


On 11/03/2016 18:57, BartC wrote:
>
> Anyway, I've listed some of the stumbling blocks I think that Python has
> in making it bit faster: http://pastebin.com/WfUfK3bc

<quote>
The String Append Benchmark

This is a microbenchmark, but makes use of a technique I use extensively 
(creating a file for example by growing a string a character at a time).

def test():
     s=""
     for i in range(10000000):
         s+="*"
     print (len(s))

test()
</quote>

The minor snag that you might like to correct with your microbenchmark, 
which any experienced Python programmer knows, is that you *NEVER, EVER* 
create strings like this.  Given that you've admitted earlier today that 
you couldn't get a simple slice to work, how much, if anything, do you 
actually know about Python?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list