Path: csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!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.130 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.76; '*S*': 0.02; 'algorithm': 0.04; 'subject:Python': 0.06; 'assume': 0.14; 'comparison.': 0.16; 'hashes': 0.16; 'sorting': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'sort': 0.25; 'post': 0.26; 'subject:/': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'code': 0.31; 'comparison': 0.31; 'equality': 0.31; 'raw': 0.33; 'could': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'two': 0.37; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'dave': 0.60; 'simply': 0.61; 'different': 0.65; 'here': 0.66; 'determine': 0.67; 'alone.': 0.84; 'case?': 0.84; 'partial': 0.84; 'subject:long': 0.84; 'angel': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=FdHY5PD/Tq9fXkKlzztWp9v/2A6YCeQaq47QGyDFAxA=; b=XoplHVfI4LVsBHVHnD/e4h12lS2B0Vy5harGvwe6jwqYV8EHN/lRfNCaGJhswvoE/L iZWBUlWxs2SUDjvSM4A16MzarNZb9yg7RHWGA9vOKh2yww2Unj84zfyeOhdZGsQmkp4b mjr5tV0eJNS4o8NOZiAK4ncsBnbhamxBpVbqh28aL/Uasc+yqoR8riHAUxPBwSiqEXh/ wLHQTkxQ8rdQDqln68TyPKPlpzFs4LRADQ1mLWMFYYyEekMqnE16fR8VvtZ978EbfL7c xGlDoJMxMUvCNvMVKiMbSNYI8Wm1btBH7Mh7lsgM0cw8i+M/ZtfqY93GMwku2QPq/byM +7LA== X-Received: by 10.66.164.6 with SMTP id ym6mr4263506pab.92.1365006686866; Wed, 03 Apr 2013 09:31:26 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <515C180A.4030302@davea.name> References: <87dff083-14d8-4163-89f3-d78a9be6c802@c15g2000vbl.googlegroups.com> <3qadncD4-6fcPsbMnZ2dnUVZ_rqdnZ2d@westnet.com.au> <515bbedb$0$29891$c3e8da3$5496439d@news.astraweb.com> <515C180A.4030302@davea.name> From: Ian Kelly Date: Wed, 3 Apr 2013 10:30:45 -0600 Subject: Re: Performance of int/long in Python 3 To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365006696 news.xs4all.nl 6877 [2001:888:2000:d::a6]:41215 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42684 On Wed, Apr 3, 2013 at 5:52 AM, Dave Angel wrote: > I'm also puzzled. I thought that the sort algorithm used a hash of all the > items to be sorted, and only reverted to a raw comparison of the original > values when the hash collided. Is that not the case? Or is the code you > post here only used when the hash collides? I think you are mistaken, because I don't see how that could work. If the hashes of two items are different then you can assume they are not equal, but sorting requires a partial ordering comparison, not simply an equality comparison. You cannot determine which item is less or greater than the other from the hash values alone.