On 12.09.12 00:47, Victor Stinner wrote:
x = x + [y] => x.append(y)
x = x + [y, z] => x.extend([y, z])
It behaves differently if x is not a list, but str for example.
Actually even worse. Transformations applicable only if x has not
aliases. Pseudocode:
if type(x) is list and refcount(x) == 1:
list.append(x, y)
else:
x = x + [y]
This optimization can be done only in the interpreter, otherwise
overhead costs will be too high.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com