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

Raymond Hettinger python at rcn.com
Fri Jun 26 17:57:55 CEST 2009

[Kristján Valur Jónsson]
> In particular, append(), pop() and insert() modify the list length, which might confuse some subclasses.

These are all part of the most basic functions of list.  A subclasser should know that.
They are different from swap() which is an optimization hack that breaks encapsulation
and is not a basic function of lists.  The docs are fine as-is.

Adding esoterica to the docs tends to make the docs harder to digest
and less useful to people trying to learn the language.


More information about the Python-ideas mailing list