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: 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> <20110324092323.GC5668@trout.vub.ac.be> <4d8bd8a1$0$29977$c3e8da3$5496439d@news.astraweb.com> <4d8d1203$0$29977$c3e8da3$5496439d@news.astraweb.com> <4d90ac87$0$30000$c3e8da3$5496439d@news.astraweb.com> <20110329084657.GE26597@trout.vub.ac.be> <4D922B91.5030505@mrabarnett.plus.com> <4D92660B.2060307@mrabarnett.plus.com> From: Ian Kelly 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Tue, Mar 29, 2011 at 5:06 PM, MRAB wrote: > I think I've found a solution: > > =A0 =A0class NegStr: > =A0 =A0 =A0 =A0def __init__(self, value): > =A0 =A0 =A0 =A0 =A0 =A0self._value =3D value > =A0 =A0 =A0 =A0def __lt__(self, other): > =A0 =A0 =A0 =A0 =A0 =A0return 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.