[Python-ideas] add a list.swap() method

Terry Reedy tjreedy at udel.edu
Thu Jun 25 19:57:30 CEST 2009

Kristján Valur Jónsson wrote:
>> -----Original Message-----
> The idea is for example to speed up the initialization of lists (and
> subclasses of lists) from other lists when the source list's contents
> is to be discarded.

Which is why 'swap' is confusing.  You want to swap list-body pointers, 
which is meaningless in Python itself. Nick's 'fromlist' is better. It 
describes the effect without reference to the backstage magic.

More information about the Python-ideas mailing list