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

woooee woooee at gmail.com
Sun Aug 21 12:59:11 EDT 2011


as the += notation seems to be a syntaxic sugar layer that has to be
converted to i = i + 1 anyway.

That has always been my understanding.  The faster way is to append to
a list as concatenating usually, requires the original string,
accessing an intermediate block of memory, and the memory for the
final string.
x_list.append(value)
to_string = "".join(x_list)



More information about the Python-list mailing list