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

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Jun 27 02:25:58 CEST 2009

Nick Coghlan wrote:

> Then again, maybe we just need to document this behaviour as a trap of
> subclassing the mutable builtins: make sure to override *all* the
> mutating methods in subclasses, not just the special methods.

I would never have imagined things were otherwise. This
is a general principle that applies to all classes, whether
builtin or not: unless explicitly documented, you can't make
any assumptions about how methods call each other internally.


More information about the Python-ideas mailing list