"Canonical" way of deleting elements from lists

Fredrik Lundh fredrik at pythonware.com
Wed Jan 9 07:41:51 EST 2008


Nick Craig-Wood wrote:

> Using keywords[:] stops the creation of another temporary list.

in CPython, "list[:] = iter" actually creates a temporary list object on 
the inside, in case "iter" isn't already a list or a tuple.

(see the implementation of PySequence_Fast() for details).

</F>




More information about the Python-list mailing list