[Python-Dev] decorate-sort-undecorate

Guido van Rossum guido at python.org
Wed Oct 15 11:16:51 EDT 2003

> If this goes in can we document that adding a key parameter makes the
> sort stable and key=None causes a stable sort to happen?  Current
> CPython won't have to do anything at all with that, but other Pythons
> (or a future CPython where a mythical faster-than-timsort nonstable
> sort is discovered) would have a documented way to force stability.

That sounds like an extremely roundabout way of doing it; *if* there
had to be a way to request a stable sort, I'd say that specifying a
'stable' keyword would be the way to do it.  But I think that's

Given that the Jython folks had Tim's sort algorithm translated into
Java in half a day, I don't see why we can't require all
implementations to have a stable sort.  It's not like you can gain
significant speed over Timsort.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list