Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2183

Re: Guido rethinking removal of cmp from sort method

Path csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=062185773=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '"if': 0.04; 'guido': 0.04; '+0100,': 0.07; 'function,': 0.07; '>>>>': 0.09; 'necessary,': 0.09; 'subject:method': 0.09; 'worse': 0.09; 'written': 0.12; '>>>': 0.12; 'wrote:': 0.14; 'cmp': 0.16; 'likewise': 0.16; 'poster': 0.16; 'poster,': 0.16; 'readability.': 0.16; 'realised': 0.16; 'received:192.168.200': 0.16; 'sorting': 0.16; 'subject:sort': 0.16; 'up."': 0.16; 'class,': 0.16; 'fixed.': 0.16; '24,': 0.19; 'written,': 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'seems': 0.21; '(which': 0.21; 'not.': 0.22; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'badly': 0.22; 'cc:addr:python-list': 0.22; 'fail': 0.22; 'thu,': 0.22; 'memory': 0.24; "didn't": 0.25; 'asked': 0.25; 'somebody': 0.25; 'cases': 0.25; 'expect': 0.26; "i'm": 0.26; 'function': 0.27; 'work.': 0.27; 'google': 0.27; 'problem': 0.29; 'fri,': 0.29; 'class': 0.29; 'fine.': 0.29; 'order.': 0.29; 'sort': 0.30; 'least': 0.30; 'implement': 0.30; 'cc:addr:python.org': 0.31; 'comparison': 0.31; "can't": 0.31; 'data,': 0.31; 'anyone': 0.31; 'done': 0.32; 'implemented': 0.33; 'using': 0.34; 'received:192': 0.34; 'there': 0.35; 'question': 0.35; 'header:User-Agent:1': 0.35; 'function.': 0.35; 'overhead': 0.35; 'too': 0.36; 'rather': 0.36; 'data': 0.37; 'received:192.168': 0.37; 'two': 0.37; 'however': 0.37; 'should': 0.37; 'either': 0.37; 'steven': 0.38; 'user': 0.38; 'but': 0.38; 'so,': 0.38; 'speak': 0.39; 'could': 0.39; 'where': 0.39; 'said': 0.39; 'would': 0.40; '2011': 0.62; 'took': 0.64; 'mar': 0.64; 'day': 0.66; 'care': 0.67; 'said:': 0.68; 'pretense': 0.84; 'subject:removal': 0.84; 'sort.': 0.91; 'approached': 0.95
X-IronPort-AV E=Sophos;i="4.63,263,1299452400"; d="scan'208";a="1164256"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Tue, 29 Mar 2011 18:10:38 +0200
From Jean-Michel Pichavant <jeanmichel@sequans.com>
User-Agent Mozilla-Thunderbird 2.0.0.24 (X11/20100328)
MIME-Version 1.0
To Steven D'Aprano <steve+comp.lang.python@pearwood.info>
Subject Re: Guido rethinking removal of cmp from sort method
References <4d7cbfcb$0$29971$c3e8da3$5496439d@news.astraweb.com> <20110323135342.GA5668@trout.vub.ac.be> <imcubd$22v$1@dough.gmane.org> <20110323151426.GB5668@trout.vub.ac.be> <AANLkTi=PTZGVqFTJ17O0xb0O7+mRmVDBsjjckgr5X-L9@mail.gmail.com> <20110324092323.GC5668@trout.vub.ac.be> <AANLkTi=Ux2wRJ8u=myd1jeneR+kZiFhtnwDLHm=GtFtV@mail.gmail.com> <mailman.1207.1300985048.1189.python-list@python.org> <4d8bd8a1$0$29977$c3e8da3$5496439d@news.astraweb.com> <mailman.1231.1301044708.1189.python-list@python.org> <4d8d1203$0$29977$c3e8da3$5496439d@news.astraweb.com>
In-Reply-To <4d8d1203$0$29977$c3e8da3$5496439d@news.astraweb.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1371.1301415119.1189.python-list@python.org> (permalink)
Lines 48
NNTP-Posting-Host 82.94.164.166
X-Trace 1301415119 news.xs4all.nl 32470 [::ffff:82.94.164.166]:41319
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2183

Show key headers only | View raw


Steven D'Aprano wrote:
> On Fri, 25 Mar 2011 10:21:35 +0100, Antoon Pardon wrote:
>
>   
>> On Thu, Mar 24, 2011 at 11:49:53PM +0000, Steven D'Aprano wrote:
>>     
>>> On Thu, 24 Mar 2011 17:47:05 +0100, Antoon Pardon wrote:
>>>
>>>       
>>>> However since that seems to be a problem for you I will be more
>>>> detailed. The original poster didn't ask for cases in which cmp was
>>>> necessary, he asked for cases in which not using cmp was cumbersome.
>>>>         
>>> I'm the original poster, and that's not what I said. I said:
>>>
>>> "If anyone has any use-cases for sorting with a comparison function
>>> that either can't be written using a key function, or that perform
>>> really badly when done so, this would be a good time to speak up."
>>>
>>> You'll notice that I said nothing about whether writing the code was
>>> easy or cumbersome, and nothing about readability.
>>>       
>> Well fine. I should have realised the question was just a pretense and
>> that there really never was any intention to consider the reactions,
>> because the answer is already fixed. Of course a key function can always
>> be written, it may just need a specific class to implement the specific
>> order. Likewise there is no reason to expect the order-functions to
>> preform worse when implemented in a class, rather than in a function.
>>     
>
> The reason Guido is considering re-introducing cmp is that somebody at 
> Google approached him with a use-case where a key-based sort did not 
> work. The use-case was that the user had masses of data, too much data 
> for the added overhead of Decorate-Sort-Undecorate (which is what key 
> does), but didn't care if it took a day or two to sort.
>
> So there is at least one use-case for preferring slowly sorting with a 
> comparison function over key-based sorting. I asked if there any others. 
> It seems not.
>
>
>   
That was known from the begining, was it ? Since key sort trades memory 
for CPU, you could expect that "masses of data" use cases may fail 
because of memory shortage.

JM

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Guido rethinking removal of cmp from sort method Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-03-29 18:10 +0200

csiph-web