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

Laurent Payot laurent.payot at gmail.com
Mon Aug 22 01:49:30 CEST 2011


I made Python my language of choice because of its readability and simpleness, and not because of its speed. But it's always good to know what is the fastest sometimes when you don't want to write a module in C. So I was just wondering if there was a difference. There is, of a few percent. Anyway I will keep on using the 2% slower "i += 1" because for me that's less prone to errors because you write the variable only once, and that's more important than speed.



More information about the Python-list mailing list