Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'assumed': 0.09; 'output,': 0.09; 'sentence': 0.09; 'python': 0.11; 'posted': 0.15; '(it': 0.16; 'cmp': 0.16; 'formed,': 0.16; 'highlight': 0.16; 'i.e.,': 0.16; 'ian.': 0.16; 'inputs': 0.16; 'key=': 0.16; 'objects.': 0.16; 'squirrel': 0.16; 'utc,': 0.16; 'wrote:': 0.18; 'basically': 0.19; 'examples': 0.20; 'input': 0.22; 'example': 0.22; 'programming': 0.22; 'issue.': 0.22; 'second': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'correct': 0.29; 'am,': 0.29; 'originally': 0.30; 'message- id:@mail.gmail.com': 0.30; 'bunch': 0.31; 'comparison': 0.31; 'safely': 0.31; 'cases': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'ordered': 0.36; 'thanks': 0.36; 'list': 0.37; 'easily': 0.37; 'expressed': 0.37; 'being': 0.38; 'mapping': 0.38; 'nov': 0.38; 'to:addr:python- list': 0.38; 'track': 0.38; 'rather': 0.38; 'subject:" ': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'algorithms': 0.60; 'ian': 0.60; 'relations': 0.60; 'first': 0.61; 'you.': 0.62; 'map': 0.64; 'more': 0.64; 'natural': 0.68; 'past,': 0.68; 'ordered.': 0.84; 'partially': 0.84; 'route': 0.84; 'few.': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=i5A2plm0Z+U9ai9hBYOkd5rQl3Wagrb+hbOZPbFTMdg=; b=Ik2HwIba30eAh4eW+6bTL6osybgu4c9+0wEnTNE5HQofZpbsFQFuc6C25+u6jgu9K7 toe/wqXj74d0Xq8qYxZ6U60wMMSNRxjLnSF0UA9NzNVOj7Bbos58O3M5A4noxOwQwQLW juLIJGCRKRnof00Wd9fhcpjmJy6P7s8LQdBjJayxNwpHwjKNXfQTj3q8WIwoWzLcp7Lr DHGWIhmcZmedy1jvcMBXb/ZLXTq2tM8eX/jbd9XdlSg8nSGOhTHbDNffYZlS5Kfr4RtC k5tmSPgQl+yhA3KR+1mKWD+QpIdObDUmp2ZGisK4Y4hnxk29daIs7BVVtffcON8WdP+E wYfw== X-Received: by 10.66.191.135 with SMTP id gy7mr41716201pac.95.1415728780447; Tue, 11 Nov 2014 09:59:40 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <534c62e0-2b6c-47ed-9aed-3c4bdbeabdc6@googlegroups.com> References: <534c62e0-2b6c-47ed-9aed-3c4bdbeabdc6@googlegroups.com> From: Ian Kelly Date: Tue, 11 Nov 2014 10:59:00 -0700 Subject: Re: "Natural" use of cmp= in sort To: Python Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415729221 news.xs4all.nl 2882 [2001:888:2000:d::a6]:46764 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80548 On Tue, Nov 11, 2014 at 2:21 AM, Paddy wrote: > On Tuesday, 11 November 2014 09:07:14 UTC, Ian wrote: >> On Tue, Nov 11, 2014 at 12:44 AM, Paddy wrote: >> > Thanks Ian. The original author states "...and it is sure that the giv= en inputs will give an output, i.e., the inputs will always be valid.", whi= ch could be taken as meaning that all inputs are sufficient, well formed, a= nd contain all relations as their first example does. >> >> Well, I brought it up because the start of that sentence is "There can >> be multiple inequalities as answer but I need any one which is >> correct...". The only way there would be more than one correct answer >> would be if the inputs were only partially ordered. I take the second >> part of the sentence as meaning only that the input can be safely >> assumed to be consistent. >> >> > Yes, I knew that there are cases where a cmp function is more natural = than key; the idea is to squirrel out a few. We have already made the, (wel= l reasoned in my opinion), decision to go down the key=3D route in Python 3= . I also like to track where my algorithms might originally map to cmp=3D. = (It is not often). >> >> Basically any time you have a comparison that isn't easily expressed >> by mapping the values to some bunch of ordered objects. > > Yep. I want to track when this comes up for me and others during their no= rmal programming rather than in examples made to highlight the issue. The example that I posted is one that I recall being brought up on this list in the past, but I don't have a link for you.