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


Groups > comp.lang.python > #2199

Re: Guido rethinking removal of cmp from sort method

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:method': 0.09; 'pm,': 0.11; 'received:74.125.82.174': 0.12; 'received:mail- wy0-f174.google.com': 0.12; 'wrote:': 0.14; '5:06': 0.16; 'cmp': 0.16; 'dressing': 0.16; 'mrab': 0.16; 'subject:sort': 0.16; '\xa0def': 0.16; 'tue,': 0.20; 'header:In-Reply-To:1': 0.22; 'function': 0.27; 'message-id:@mail.gmail.com': 0.28; 'key.': 0.31; 'to:addr:python-list': 0.32; "i've": 0.33; 'think': 0.36; 'received:google.com': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'taking': 0.61; '2011': 0.62; 'mar': 0.64; 'subject:removal': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=iE+Wfw3vxTlbFhUKKy11Yhf38JGWmoH99hWbnLe5CEI=; b=BSwQezFGOL7ZgxYqhdoPN1YXxVy8LaE0n0OQfgSlY0Q9YUrQ5B8a5n0GKyY4kaGbrI FyL0SUGKshicln6u02d3NYANIxXZIvNwiKBE5SdmDcAvnO/YUvuFgaAvPWELV7kTQMQ+ +vbzsLh12FfDXWP3n4+IALANNCBRHoyZk39ls=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=k143p4CHtgThcqGTk8K+f2qrxWGJoGwm7N2NGQRNfgZw1EJHWjw6ywbJK9NZENMv/B fv0ZJmCPfgAra9lMZBkvDGOB6nTA/tzak9qr6FeeXcTp8MDMtiVpw7/jBieobk8nblNx Tk55YnCnx1CXYg1grltfltgf3uPt88rtaTmsM=
MIME-Version 1.0
In-Reply-To <4D92660B.2060307@mrabarnett.plus.com>
References <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> <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> <4D922B91.5030505@mrabarnett.plus.com> <AANLkTiktvGrpJM6AYP7yEYXj8heqz61ey3FuLSJG7wQH@mail.gmail.com> <AANLkTinfLaedDYKd9KeSihh5wz09fuwXN0jSV-jHQeAG@mail.gmail.com> <AANLkTinXCMTduz96su=avK4NN3PQLhgbzLi5jWA69W0g@mail.gmail.com> <4D92660B.2060307@mrabarnett.plus.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 29 Mar 2011 17:36:18 -0600
Subject Re: Guido rethinking removal of cmp from sort method
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
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.2.1301441811.2990.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 82.94.164.166
X-Trace 1301441811 news.xs4all.nl 32470 [::ffff:82.94.164.166]:41573
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2199

Show key headers only | View raw


On Tue, Mar 29, 2011 at 5:06 PM, MRAB <python@mrabarnett.plus.com> wrote:
> I think I've found a solution:
>
>    class NegStr:
>        def __init__(self, value):
>            self._value = value
>        def __lt__(self, other):
>            return self._value > other._value

IOW:

cmp_to_key(lambda x, y: -cmp(x, y))

This is still just taking a cmp function and dressing it up as a key.

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


Thread

Re: Guido rethinking removal of cmp from sort method Ian Kelly <ian.g.kelly@gmail.com> - 2011-03-29 17:36 -0600
  Re: Guido rethinking removal of cmp from sort method Paul Rubin <no.email@nospam.invalid> - 2011-03-29 17:23 -0700

csiph-web