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


Groups > comp.lang.python > #5857

Re: hash values and equality

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'value,': 0.04; 'mrab': 0.05; '21,': 0.09; 'hash': 0.09; 'integer,': 0.09; 'am,': 0.14; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'wrote:': 0.14; '(is': 0.16; 'angelico': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'header:In-Reply-To:1': 0.21; 'objects,': 0.23; 'objects': 0.23; 'index': 0.25; 'stored': 0.25; 'message- id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; 'sat,': 0.29; 'elements': 0.29; 'array': 0.30; 'looks': 0.31; 'to:addr :python-list': 0.33; 'it?': 0.33; 'chris': 0.34; 'there': 0.35; 'identical': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.37; 'two': 0.37; 'could': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'spell': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=JLiLuG3H5ZvtfXQDk2bwI9Sak0A7dbFQWrxKfAf1WyM=; b=awa8Nqfv5fPMvY4L9S6YvIA6a1rDOyVKPACemaB2pqDg4B256M44Zp4PCCdiLkw/e0 TJAtoVVVliVmc6SZxSTiJfJeXSMXbWNj06rpVdfYy8YVIU5KPvB2ESlnwenBIdKuS+kA 5C1A5q3HOw8H+1xRXMnf6xL9bmh4Np2RpKMiU=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=k44qlS30t21WSboRHiMd9FD6TqeKf0Y2XzHWn4vztOlwsmhaSnuv1zTRJ07RV4PyCN du4tD5Ufpie6/6IhqE4mkwOLkA53Ip18Jy/6kPUmxJJZuXVhKYitnI2VRERCjOPxAK5G FNfCMmHifJ8G+WG9X/wyy8wbBQEhzMdaIj0f4=
MIME-Version 1.0
In-Reply-To <4DD68DAA.9050209@mrabarnett.plus.com>
References <4DD2C2A5.3080403@stoneleaf.us> <BANLkTimvzZeN5dmm2xHP5xV8Kpw2Nb9kuQ@mail.gmail.com> <4DD2D89D.4000303@stoneleaf.us> <BANLkTintqgBLFtBx8+1b+R10nywuKdKHOw@mail.gmail.com> <4DD2F661.2050005@stoneleaf.us> <BANLkTikx8U4jWwLXXazpmtsL6MasDmyVyg@mail.gmail.com> <BANLkTi=_GqrNntRU7pv7x=kj3gHurk-Gaw@mail.gmail.com> <mailman.1822.1305870290.9059.python-list@python.org> <0deha8-6u9.ln1@satorlaser.homedns.org> <4DD68DAA.9050209@mrabarnett.plus.com>
Date Sat, 21 May 2011 02:20:04 +1000
Subject Re: hash values and equality
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.1841.1305908408.9059.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 82.94.164.166
X-Trace 1305908408 news.xs4all.nl 49184 [::ffff:82.94.164.166]:58001
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5857

Show key headers only | View raw


On Sat, May 21, 2011 at 1:50 AM, MRAB <python@mrabarnett.plus.com> wrote:
> [snip]
> Is this strictly true? I thought that the hash value, an integer, is
> moduloed (Is that how you spell it? Looks weird!) with the number of
> array elements to give an index into the array, so different hashes
> could give the same index, and objects with different hashes could be
> stored in the same 'bucket'.

There can always be hash collisions between different objects, but the
assumption is that two identical objects will _always_ "collide".

Chris Angelico

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


Thread

hash values and equality Ethan Furman <ethan@stoneleaf.us> - 2011-05-19 22:43 -0700
  Re: hash values and equality Peter Otten <__peter__@web.de> - 2011-05-20 08:38 +0200
    Re: hash values and equality Ethan Furman <ethan@stoneleaf.us> - 2011-05-20 10:57 -0700
    Re: hash values and equality Peter Otten <__peter__@web.de> - 2011-05-20 22:25 +0200
    Re: hash values and equality Ethan Furman <ethan@stoneleaf.us> - 2011-05-20 14:48 -0700
  Re: hash values and equality Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-05-20 08:33 +0200
    Re: hash values and equality MRAB <python@mrabarnett.plus.com> - 2011-05-20 16:50 +0100
    Re: hash values and equality Chris Angelico <rosuav@gmail.com> - 2011-05-21 02:20 +1000
    Re: hash values and equality Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-20 11:59 -0600
    Re: hash values and equality Ethan Furman <ethan@stoneleaf.us> - 2011-05-20 11:38 -0700
      Re: hash values and equality Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-21 20:24 +1200
        Re: hash values and equality Peter Otten <__peter__@web.de> - 2011-05-21 11:24 +0200
    Re: hash values and equality Christian Heimes <lists@cheimes.de> - 2011-05-20 21:01 +0200
    Re: hash values and equality MRAB <python@mrabarnett.plus.com> - 2011-05-20 21:17 +0100
      Re: hash values and equality Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-21 00:47 +0000
        Re: hash values and equality MRAB <python@mrabarnett.plus.com> - 2011-05-21 02:02 +0100
          Re: hash values and equality Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-21 01:55 +0000
    Re: hash values and equality John Nagle <nagle@animats.com> - 2011-05-21 15:55 -0700
      Re: hash values and equality Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2011-05-22 01:07 +0200
      Re: hash values and equality Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-22 00:24 +0000

csiph-web