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


Groups > comp.lang.python > #2422

Re: Guido rethinking removal of cmp from sort method

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!weretis.net!feeder5.news.weretis.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <debatem1@gmail.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; '(at': 0.03; 'pypi': 0.04; 'test,': 0.04; 'wed,': 0.04; 'python.': 0.05; '2.7': 0.05; 'chunk': 0.07; 'complaining': 0.07; 'fine,': 0.07; 'received:mail- qy0-f174.google.com': 0.07; "shouldn't": 0.07; 'suggesting': 0.07; 'python': 0.07; 'deliberately': 0.09; 'extension.': 0.09; 'imported.': 0.09; 'indicates': 0.09; 'pieces': 0.09; 'prerequisite': 0.09; 'subject:method': 0.09; 'undefined': 0.09; 'api': 0.11; 'pm,': 0.11; 'this:': 0.11; '>>>': 0.12; 'request,': 0.14; 'wrote:': 0.14; 'library': 0.15; '"from': 0.16; 'advocating': 0.16; 'clear:': 0.16; 'cmp': 0.16; 'extensions,': 0.16; 'functools': 0.16; 'gone,': 0.16; 'istm': 0.16; 'one-': 0.16; 'received:209.85.216.174': 0.16; 'sorting': 0.16; 'subject:sort': 0.16; 'test".': 0.16; 'argument': 0.16; 'removed.': 0.16; 'code.': 0.18; 'anyway.': 0.19; "hasn't": 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'code,': 0.20; 'programming': 0.20; 'saying': 0.22; 'code': 0.22; 'header:In- Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; '(and': 0.22; '"not': 0.23; 'module,': 0.23; 'similarly': 0.23; 'wonder': 0.24; 'cases': 0.25; 'pointing': 0.25; 'assume': 0.25; 'guess': 0.26; "i'm": 0.26; 'regardless': 0.26; '(in': 0.27; 'pass': 0.27; 'function': 0.27; 'message-id:@mail.gmail.com': 0.28; 'developers': 0.28; 'testing': 0.28; 'string': 0.29; 'fri,': 0.29; '"this': 0.29; 'certainly': 0.29; 'developers.': 0.29; 'push': 0.29; "python's": 0.29; 'third-party': 0.29; 'probably': 0.30; 'sort': 0.30; 'least': 0.30; 'implement': 0.30; "won't": 0.30; 'cc:addr:python.org': 0.31; 'one,': 0.31; 'comparison': 0.31; 'fans': 0.31; 'feature,': 0.31; 'granted,': 0.31; 'survive': 0.31; 'fact': 0.31; "can't": 0.31; 'determine': 0.31; 'functional': 0.31; 'language.': 0.31; 'anyone': 0.31; 'import': 0.32; 'another': 0.32; 'implemented': 0.33; 'pure': 0.33; 'community': 0.33; 'bit': 0.33; 'module': 0.33; 'test': 0.33; "isn't": 0.34; 'using': 0.34; 'actually': 0.34; 'change': 0.34; 'there': 0.35; 'point': 0.35; '-0700,': 0.35; 'race,': 0.35; 'test.': 0.35; 'feature': 0.36; 'think': 0.36; 'case,': 0.36; 'data': 0.37; 'some': 0.37; 'should': 0.37; 'received:209.85': 0.37; 'useful': 0.37; 'took': 0.64; '(3)': 0.64; 'mar': 0.64; 'overall': 0.64; 'interest': 0.65; 'grab': 0.65; 'prove': 0.65; 'care': 0.67; 'download.': 0.68; 'past.': 0.68; 'alternative': 0.69; 'soon.': 0.72; 'offer': 0.72; 'hundred': 0.74; '30,': 0.80; 'thousand': 0.83; 'lose': 0.84; '4000': 0.84; 'battle': 0.84; 'experiment': 0.84; 'horse': 0.84; 'inclusion': 0.84; 'popularity': 0.84; 'practical,': 0.84; 'subject:removal': 0.84; 'lost,': 0.91; 'engaging': 0.93; 'was.': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=JjzPwU6le7bgy6cMu0ocsIPzIt2fafsx8baJ9n8vJsw=; b=iigk8r5q9wkyes695cGFFR+6I9++pMlAi3uM+MCboWZelRmenmc6PcPmyONtncnu0t 11qdCtEdrp9MIQgUbBqaNaqsr/A6Z0efBSGyja4dbwtuDFCMDKpsWo1Mqtj6UlPMNU3w 3x3Jk92uj0P5U3+kNQigPMFICddjkkpMGWoho=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=AAjUq6drA+4apJl0JBjKcT56geEmTMo9xS15R1Kt792gnke1LAeGgS8CuUYSXMZfyd A2QLHHEj10eSS3itayNEiDHrWTjmUFwHDwMIrPq5AtIuC0HPyfFkirUyUzDhb+32uQ7C +qnsCJoS5HzvjMD0JmEVFsFxTKN1gUBLbvsO8=
MIME-Version 1.0
In-Reply-To <4d9670a9$0$29992$c3e8da3$5496439d@news.astraweb.com>
References <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> <mailman.1333.1301315748.1189.python-list@python.org> <4d90ac87$0$30000$c3e8da3$5496439d@news.astraweb.com> <20110329084657.GE26597@trout.vub.ac.be> <AANLkTinyEpTVaAjikP8M108ymj=J6LV2styp+Md-siwj@mail.gmail.com> <imtcab$r3r$1@dough.gmane.org> <mailman.9.1301475780.2990.python-list@python.org> <4d93e360$0$29996$c3e8da3$5496439d@news.astraweb.com> <mailman.105.1301693472.2990.python-list@python.org> <4d9670a9$0$29992$c3e8da3$5496439d@news.astraweb.com>
Date Fri, 1 Apr 2011 18:22:01 -0700
Subject Re: Guido rethinking removal of cmp from sort method
From geremy condra <debatem1@gmail.com>
To "Steven D'Aprano" <steve+comp.lang.python@pearwood.info>
Content-Type text/plain; charset=ISO-8859-1
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.113.1301707325.2990.python-list@python.org> (permalink)
Lines 100
NNTP-Posting-Host 82.94.164.166
X-Trace 1301707325 news.xs4all.nl 81476 [::ffff:82.94.164.166]:57442
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2422

Show key headers only | View raw


On Fri, Apr 1, 2011 at 5:41 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Fri, 01 Apr 2011 14:31:09 -0700, geremy condra wrote:
>
>> On Wed, Mar 30, 2011 at 7:13 PM, Steven D'Aprano
>> <steve+comp.lang.python@pearwood.info> wrote:
>>
>> <snip>
>>
>>> Or, an alternative approach would be for one of the cmp-supporters to
>>> take the code for Python's sort routine, and implement your own
>>> sort-with- cmp (in C, of course, a pure Python solution will likely be
>>> unusable) and offer it as a download. For anyone who knows how to do C
>>> extensions, this shouldn't be hard: just grab the code in Python 2.7
>>> and make it a stand- alone function that can be imported.
>>>
>>> If you get lots of community interest in this, that is a good sign that
>>> the solution is useful and practical, and then you can push to have it
>>> included in the standard library or even as a built-in.
>>>
>>> And if not, well, at least you will be able to continue using cmp in
>>> your own code.
>>
>> I don't have a horse in this race, but I do wonder how much of Python
>> could actually survive this test. My first (uneducated) guess is "not
>> very much"- we would almost certainly lose large pieces of the string
>> API and other builtins, and I have no doubt at all that a really
>> significant chunk of the standard library would vanish as well. In fact,
>> looking at the data I took from PyPI a while back, it's pretty clear
>> that Python's feature set would look very different overall if we
>> applied this test to everything.
>
>
> I don't understand what you mean by "this test".

I mean testing whether a feature should be in Python based on whether
it can meet some undefined standard of popularity if implemented as a
third-party module or extension.

> I'm certainly not suggesting that we strip every built-in of all methods
> and make everything a third-party C extension. That would be insane.

Granted, but I think the implication is clear: that only those
features which could be successful if implemented and distributed by a
third party should be in Python. My argument is that there are many
features currently in Python that I doubt would pass that test, but
which should probably be in anyway. The conclusion I draw from that is
that this isn't a particularly good way to determine whether something
should be in standard Python.

> Nor do I mean that every feature in the standard library should be forced
> to prove itself or be removed. The features removed from Python 3 were
> deliberately few and conservative, and it was a one-off change (at least
> until Python 4000 in the indefinite future). If something is in Python 3
> *now*, you can assume that it won't be removed any time soon.

I may have been unclear, so let me reiterate: I'm not under the
impression that you're advocating this as a course of action. I'm just
pointing out that the standard for inclusion you're advocating is
probably not a particularly good one, especially in this case, and
engaging in a bit of a thought experiment about what would happen if
other parts of Python were similarly scrutinized.

> What I'm saying is this: cmp is already removed from sorting, and we
> can't change the past. Regardless of whether this was a mistake or not,
> the fact is that it is gone, and therefore re-adding it is a new feature
> request. Those who want cmp functionality in Python 3 have three broad
> choices:

I might quibble over whether re-adding is the same as a new feature
request, but as I said- I don't care about cmp.

> (1) suck it up and give up the fight; the battle is lost, move on;
>
> (2) keep arguing until they either wear down the Python developers or get
> kill-filed; never give up, never surrender;
>
> (3) port the feature that they want into a third-party module, so that
> they can actually use it in code, and then when they have evidence that
> the community needs and/or wants this feature, then try to have it re-
> added to the language.
>
> I'm suggesting that #3 is a more practical, useful approach than writing
> another hundred thousand words complaining about what a terrible mistake
> it was. Having to do:
>
> from sorting import csort
>
> as a prerequisite for using a comparison function is not an onerous
> requirement for developers. If fans of functional programming can live
> with "from functools import reduce", fans of cmp can live with that.

And that's fine, as I said I don't have a horse in this race. My point
is just that I don't think the standard you're using is a good one-
ISTM that if it *had* been applied evenly we would have wound up with
a much less complete (and much less awesome) Python than we have
today. That indicates that there are a reasonable number of real-world
cases where it hasn't and shouldn't apply.

Geremy Condra

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


Thread

Re: Guido rethinking removal of cmp from sort method Antoon Pardon <Antoon.Pardon@rece.vub.ac.be> - 2011-03-30 11:06 +0200
  Re: Guido rethinking removal of cmp from sort method Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-03-31 02:13 +0000
    Re: Guido rethinking removal of cmp from sort method Antoon Pardon <Antoon.Pardon@rece.vub.ac.be> - 2011-03-31 11:41 +0200
      Re: Guido rethinking removal of cmp from sort method Paul Rubin <no.email@nospam.invalid> - 2011-03-31 04:59 -0700
    Re: Guido rethinking removal of cmp from sort method geremy condra <debatem1@gmail.com> - 2011-04-01 14:31 -0700
      Re: Guido rethinking removal of cmp from sort method Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-02 00:41 +0000
        Re: Guido rethinking removal of cmp from sort method geremy condra <debatem1@gmail.com> - 2011-04-01 18:22 -0700
          Re: Guido rethinking removal of cmp from sort method Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-02 11:01 +0000
            Re: Guido rethinking removal of cmp from sort method geremy condra <debatem1@gmail.com> - 2011-04-02 23:22 -0700
            Re: Guido rethinking removal of cmp from sort method Brian Quinlan <brian@sweetapp.com> - 2011-04-03 16:34 +1000
              Re: Guido rethinking removal of cmp from sort method Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-03 10:21 +0000
                Re: Guido rethinking removal of cmp from sort method geremy condra <debatem1@gmail.com> - 2011-04-03 12:58 -0700
        Re: Guido rethinking removal of cmp from sort method Paul Rubin <no.email@nospam.invalid> - 2011-04-01 19:29 -0700
          Re: Guido rethinking removal of cmp from sort method Chris Angelico <rosuav@gmail.com> - 2011-04-02 13:43 +1100
          Re: Guido rethinking removal of cmp from sort method Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-02 11:27 +0000

csiph-web