NaN, Null, and Sorting
Robert Kern
robert.kern at gmail.com
Mon Jan 16 06:07:26 EST 2012
On 1/16/12 10:57 AM, Chris Angelico wrote:
> On Mon, Jan 16, 2012 at 9:22 PM, Eelco<hoogendoorn.eelco at gmail.com> wrote:
>> What you want, conceptually, is a
>> sorted list of the sortable entries, and a seperate list of the
>> unsorted entries. Translated into code, the most pure solution would
>> be to filter out the nanas/nulls in their own list first, and then
>> sort the rest. If the interface demands it, you can concatenate the
>> lists afterwards, but probably it is most convenient to keep them in
>> seperate lists.
>
> So... you split it into two lists, sort the two lists (one of which
> can't be sorted), and then concatenate them. Sounds like the quicksort
> algorithm.
Not at all. The "split it into two lists" steps are entirely different in what
Eelco suggested and quicksort. It's misleading to attempt to describe both using
the same words.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list