[Python-Dev] timsort for jython

Fredrik Lundh fredrik@pythonware.com
Mon, 5 Aug 2002 15:29:19 +0200

tim wrote:

> > You also don't need to hold back on giving stability garanties in the
> > documentation for jython's sake.
> I didn't <wink>.  Stability doesn't come free, and for all I know, in
> another 3 years a method will be discovered that's 3x faster but not
> stable.

sounds like yet another reason to add two methods; one that
guarantees stability, and one that doesn't.

the only counter-argument I've seen from you is code bloat, but
I cannot see what stops us from mapping *both* methods to a
single implementation in CPython 2.3.

an alternative would be to add a sortlib module:

    $ more Lib/sortlib.py

    def stablesort(list):
        list.sort() # 2.3's timsort is stable!

and a regression test script that makes sure that it really is stable
(can a test program ever be sure?)