can't sort

andrew cooke andrew at acooke.org
Tue May 27 07:57:57 EDT 2003


"Tim Peters" <tim_one at email.msn.com> writes:
> > ps is the dsu speed advantage really significant?  i normally ignore
> > log(n) factors (am i admitting to some terrible misdemeanour?!) as not
> > being worth the bother...
> 
> Time it.  It's N log N either way, of course, the difference is in saving N
> log N Python-level function calls.

the claim made at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52234 is that
building and unpacking the projected list is negligable when n is
large (O(n), not n log(n)).  but i took that without thinking and i'm
sure you're right - that the real advantage is in avoiding calling a
separate comparison function (since the alternative is to put the
projection "inside" the comparison function).

(which makes finding a way to put the comparison function into the
projection even more attractive)

andrew

-- 
http://www.acooke.org






More information about the Python-list mailing list