On Tue, 06 Oct 2009 23:20:13 -0700, Paul Rubin wrote:

> Bearophile <bearophileh...@lycos.com> writes:
>> sorting, and something that's surely not bug-prone. In such situation
>> having a 'key' argument is *better*. Such sort can be stable.
> 
> Nothing stops comparison sorting from being stable.  Since the rest of
> your post seems premised on the opposite, I hope that clears things up
> for you.

I'm sure Paul already knows this, but key-based sorts are comparison 
sorts.

There are two basic types of sorts: comparison based, where the routine 
has to compare items (usually with the < operator), and non-comparison 
sorts, like bucket sort, pigeon-hole sort and radix sort. These sorts 
require special knowledge of the items being sorted, and don't need to 
compare two items. General purpose sorts like Python's sort() do, 
regardless of whether you pass a key function, a three-way comparison 
function, or something else.




-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to