[Python-ideas] add a list.swap() method
python at rcn.com
Fri Jun 26 05:36:43 CEST 2009
> I suggested adding extra functionality to
> list.__new__, and Nick suggested a new constructor list.from_list().
> Nick suggested making from_list destructive, but I don't see the
> advantage of doing so. I
FWIW, the constructor for list objects already has a fast path
for copying an input list or tuple. So the only new thing you can
add is a destructive, steal the pointer approach that breaks
encapsulation and opens a can of worms.
More information about the Python-ideas