Python's simplicity philosophy
Mon Nov 17 18:23:26 CET 2003
"Andrew Dalke" <adalke at mindspring.com> writes:
> > Surely he was talking about implementing "list-alikes"...?
> Yes, I think you're right about that, and I misinterpreted
> his statement.
Yes, I was talking about "list-alikes".
> Then again, is the change that "all Python list-alikes must
> implement stable sort" or that "Python native lists shall
> now and forever implement stable sort"?
The change was that native lists will implement stable sort. My gripe
is that if native lists are required to sort stably and list-alikes
can sort unstably, then list.sort and listalike.sort act differently
in a way that can lead to subtle bugs.
> That's a statement only that list.sort shall be stable and
> not that all .sort() methods must be stable.
It would be icky if some .sort() methods are required to be stable but
others are not.
Note that the most obvious way to implement sort() in C is to call the
standard C library qsort function, which is unstable.
More information about the Python-list