[Python-Dev] decorate-sort-undecorate
Alex Martelli
aleaxit at yahoo.com
Tue Oct 14 11:00:33 EDT 2003
On Tuesday 14 October 2003 04:50 pm, Guido van Rossum wrote:
...
> > case seems important enough to me that I'd accept any arbitrary
> > non-comparing behavior (e.g. making the id of the thing being sorted
> > the secondary key!-) rather than default to whole-record compares.
>
> Given that internally we still do a DSU, sorting tuples of (key,
> something), using the id of the record for 'something' is just as
> inefficient as using the original index -- in both cases we'd have to
> allocate len(lst) ints.
Yes, of course, I was just being facetious -- sorry for not making that
clearer.
> Greg Ewing suggested that the ints shouldn't have to be Python ints.
> While this is true, it would require a much larger overhaul of the
> existing sort code, which assumes the "records" to be sorted are
> pointers to objects.
Again, true. But maybe the performance increase would be worth
the substantial effort (I don't understand the current sort code enough
to say more than "maybe"!-).
Alex
More information about the Python-Dev
mailing list