[Python-Dev] decorate-sort-undecorate

Guido van Rossum guido at python.org
Tue Oct 14 13:43:50 EDT 2003


> As has been pointed out, we already have a stable sort.  Instead of
> making stability an option, let's just keep it.

If this can be done without any of the disadvantages brought up at
some point (especially allocating millions of ints), by all means
let's do it.

> We could allocate a second array of PyObject* to mirror the list
> contents; that would have only the keys.  When two values are switched
> in the sort, the values in both the key list and the value list can be
> switched.  When done, we only need to decref the computed keys and
> free the array of keys.

I can't tell if that'll work, but if it does, it would be a great solution.

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



More information about the Python-Dev mailing list