relative speed of incremention syntaxes (or "i=i+1" VS "i+=1")

Laurent laurent.payot at gmail.com
Sun Aug 21 16:04:24 EDT 2011


I did the test several times with floats on my machine and the difference is not as big as for integers:


==> "i = i + 1.0" is 0.732% faster than "i += 1.0".

It seems normal as the float addition is supposed to be slower than integer addition, thus the syntaxic difference is comparatively less important. 



More information about the Python-list mailing list