On 6/20/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> > It's not true that the sort must complete (or that the whole file must
> > be read for that matter), Python has cool generators which makes the
> > above possible.
>
> That's not possible, the input must be read completely before sorted() can
> output anything. Suppose the minimum element is at the end - until you
> read it, you can't output the very first sorted element.

Doh! Yes of course. I always thought that sorted() returned a
generator. Since Python's sort is based on merge sort, using a
generator approach it should at least be theoretically possible to
begin emitting the items before the sort operation completes.

-- 
mvh Björn
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to