A better self

Terry Reedy tjreedy at udel.edu
Wed Jul 24 20:20:58 EDT 2002


"Michael Chermside" <mcherm at destiny.com> wrote in message
news:mailman.1027533340.29544.python-list at python.org...
>      # A program to sort lines. Takes, as command-line argument, a
...
> But all of these are dwarfed (for large file sizes... let's say 1 GB
of
> text) by the fact that you are running a REALLY FAST sort algorithm.

Few of us appreciate the days that Tim Peters spent writing a portable
sort program that is significantly better than standard quicksort for
several classes of input (such as a sorted list with new items
appended to the end).  He is currently working on another that may be
even better.  (Three horn toots for Tim.)

> Of course, you could code the same sort algorithm in C yourself.

Hmm.  How many of us have both the skill and patience to develop and
test such a delicate and complex algorithm tweaked for various special
cases -- and apparently release it bug free (Tim says there has never
been a report of the current sort malfunctioning).

> for that matter, you could copy the sort algorithm (written in C)
from
> the C source to Python (Python's liscense allows that!). But you
> wouldn't. Really... you wouldn't.

Only if really forced to by a crazy employer.

>(notice how I never  had to stop to think about memory allocation or
max line lengths?).

Yes -- or number of lines.  Merely writing the generic C equivalent of

lines = file('datalines.txt').readlines()

is a bit of a headache.  Nice posting.

Terry J. Reedy






More information about the Python-list mailing list