<br><div class="gmail_quote">On Sun, Mar 13, 2011 at 5:59 AM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve%2Bcomp.lang.python@pearwood.info">steve+comp.lang.python@pearwood.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
The removal of cmp from the sort method of lists is probably the most<br>
disliked change in Python 3. On the python-dev mailing list at the<br>
moment, Guido is considering whether or not it was a mistake.<br>
<br>
If anyone has any use-cases for sorting with a comparison function that<br>
either can't be written using a key function, or that perform really<br>
badly when done so, this would be a good time to speak up </blockquote></div><br>The point of increased memory use seems possibly relevant.  I tried to test for
 that yesterday using some big lists of tuples of floats, and didn't see it 
having much significance (if anything the cmp version seemed to take More memory), but it might merit further study, as it'll be a while before cell phones (and refrigerators) have 
an excess of memory - and I very much want to run Python on my cell phone (and wouldn't mind it on my fridge).<br>
<br>
There's also the issue of a lazy comparison function, that I don't seem 
to have gotten a response to - if you have a Very expensive comparison 
operation involving megabytes or even gigabytes of data, and want to 
perform just enough of it to get the job done, how does one do this with
 a key comparator and no cmp comparator?  It seems like you could almost do it by using a generator for your key comparator, but it also seems like the stuff in memory would add up really (too) fast.  This program has an example:<br>
<div style="margin-left: 40px;"><a href="http://stromberg.dnsalias.org/~strombrg/equivalence-classes.html#python">http://stromberg.dnsalias.org/~strombrg/equivalence-classes.html#python</a><br>(The version at the following URL might be a little newer)<br>
<a href="http://stromberg.dnsalias.org/cgi-bin/viewvc.cgi/equivalence-classes/trunk/equivs2-python/?root=svn">http://stromberg.dnsalias.org/cgi-bin/viewvc.cgi/equivalence-classes/trunk/equivs2-python/?root=svn</a><br></div>
<br>