Alf P. Steinbach a écrit :
* candide:
Suppose a and b are lists.
What is more efficient in order to extend the list a by appending all
the items in the list b ?
I imagine a.extend(b)to be more efficient for only appendinding the
items from b while a+=b creates a copy of a before appending, right ?
No.
But in general, if you're concerned about efficiency, *measure*.
But my question refers to memory management rather than to time
execution. Imagine foo is a big size list and bar is a small one. It
would be a waste of memory to copy list foo somewhere in memory before
appending the items in bar.
--
http://mail.python.org/mailman/listinfo/python-list