Re: sort() method

Jack Jansen (Jack.Jansen@cwi.nl)
Wed, 15 Jul 1992 10:25:49 +0200

I don't think that having a built-in sort() with user-supplied compare
routine would be a big win when compared to programming sort yourself.
Calling out to the python code would probably loose you most of the
performance that programming in C would win you.

The only reasons I program some stuff I C are:
- features inaccessible from python (or difficult to access), like
system calls or things involving hairy C structures, and
- manipulation of huge amounts of small data-items, like finding the
average value of a sound sample (stored as byte values in a string).

The second case is why you want to program sort() in C, but if you
have to wrap each item as a python object and call out to a python
compare routine you loose the advantage.

A generic sort module in python should be peanuts, though. Anyone feel
like writing one?

--
Jack Jansen        | If I can't dance I don't want to be part of
Jack.Jansen@cwi.nl | your revolution             -- Emma Goldman
uunet!cwi.nl!jack    G=Jack;S=Jansen;O=cwi;PRMD=surf;ADMD=400net;C=nl