Inheritance from builtin list and override of methods.

Carl Banks pavlovevidence at
Tue Nov 28 16:31:26 CET 2006

OKB (not okblacke) wrote:
> Carsten Haese wrote:
> > You can change the behavior of a list's sort method by overriding
> > sort. You can't change the behavior of sort by overriding
> > __getitem__ and __setitem__, because sort does not call __getitem__
> > or __setitem__.
>     	Why doesn't it?

Because the concerns of thousands of legitimate programmers who want
good performance out of their sorts outweigh the concerns of the one or
two hax0r d00ds who think it would be cool to hook into sort internals.

live-long-and-prosper-ly yr's,

Carl Banks

More information about the Python-list mailing list