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


Groups > comp.lang.python > #80548

Re: "Natural" use of cmp= in sort

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 <ian.g.kelly@gmail.com>
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 <eb697764-934b-4650-af28-1c55520bc1da@googlegroups.com> <fc99182d-8779-460d-90b7-4e9a8ff9c548@googlegroups.com> <mailman.15647.1415687819.18130.python-list@python.org> <f1ba3294-f31d-47a8-9728-14a3c3110208@googlegroups.com> <mailman.15654.1415696821.18130.python-list@python.org> <534c62e0-2b6c-47ed-9aed-3c4bdbeabdc6@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 11 Nov 2014 10:59:00 -0700
Subject Re: "Natural" use of cmp= in sort
To Python <python-list@python.org>
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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15683.1415729221.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Tue, Nov 11, 2014 at 2:21 AM, Paddy <paddy3118@gmail.com> wrote:
> On Tuesday, 11 November 2014 09:07:14 UTC, Ian  wrote:
>> On Tue, Nov 11, 2014 at 12:44 AM, Paddy <paddyxxx-at-xmail.com> wrote:
>> > Thanks Ian. The original author states "...and it is sure that the given inputs will give an output, i.e., the inputs will always be valid.", which could be taken as meaning that all inputs are sufficient, well formed, and 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, (well reasoned in my opinion), decision to go down the key= route in Python 3. I also like to track where my algorithms might originally map to cmp=. (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 normal 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.

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


Thread

"Natural" use of cmp= in sort Paddy <paddy3118@gmail.com> - 2014-11-10 10:45 -0800
  Re: "Natural" use of cmp= in sort Peter Otten <__peter__@web.de> - 2014-11-10 20:19 +0100
  Re: "Natural" use of cmp= in sort Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-10 12:43 -0700
    Re: "Natural" use of cmp= in sort Paddy <paddy3118@gmail.com> - 2014-11-10 18:03 -0800
  Re: "Natural" use of cmp= in sort Paddy <paddy3118@gmail.com> - 2014-11-10 19:09 -0800
    Re: "Natural" use of cmp= in sort Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-10 23:36 -0700
      Re: "Natural" use of cmp= in sort Paddy <paddy3118@gmail.com> - 2014-11-10 23:44 -0800
        Re: "Natural" use of cmp= in sort Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-11 01:35 -0700
          Re: "Natural" use of cmp= in sort Paddy <paddy3118@gmail.com> - 2014-11-11 01:21 -0800
            Re: "Natural" use of cmp= in sort Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-11 10:59 -0700
              Re: "Natural" use of cmp= in sort Paddy <paddy3118@gmail.com> - 2014-11-12 00:09 -0800

csiph-web