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


Groups > comp.lang.python > #20151

Re: frozendict

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.044
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'interpreter': 0.05; 'differently.': 0.07; 'python': 0.08; 'dict': 0.09; 'run.': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'predictable': 0.16; 'received:209.85.213.174': 0.16; 'received :mail-yx0-f174.google.com': 0.16; 'language': 0.16; 'wrote:': 0.18; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'structure': 0.26; 'code.': 0.26; 'function': 0.27; 'code,': 0.28; 'order.': 0.28; 'script': 0.28; 'message-id:@mail.gmail.com': 0.29; 'pm,': 0.29; 'hash': 0.30; 'varies': 0.30; 'nobody': 0.31; 'source': 0.32; 'that,': 0.32; "isn't": 0.33; 'fri,': 0.34; 'anything': 0.34; 'keys': 0.34; 'to:addr:python-list': 0.35; 'something': 0.35; 'created': 0.37; 'received:google.com': 0.37; 'another': 0.37; 'either': 0.37; 'received:209.85': 0.38; 'back.': 0.38; 'could': 0.38; 'think': 0.38; 'data': 0.38; 'received:209': 0.39; 'being': 0.40; 'put': 0.40; 'to:addr:python.org': 0.40; 'more': 0.61; 'your': 0.61; 'results': 0.64; 'ever': 0.64; 'series': 0.67; 'exact': 0.68; '100%': 0.82; 'different.': 0.84; 'nathan': 0.84; 'ubiquitous': 0.84; 'promised': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=eFucGqbgsT5fbz1+DqUcBUaFbiBS0AGoUUXW8FCcHkE=; b=JUmdMCP5HhTwAa1znBYHRJbgfwI/fdMkvmzfMdh2ITAQJyNd1eOzs6/uS9SrCNgh+v H2rtLuhOcBYi7WWsiVCHEn/AB6oKTeuUt56/hm9Df4IE+HyIl21PpV/Y/eC0fb9dPoiB b3IqSkAngSoRWr4lgIGKJf10UvmnkRshUHEg0=
MIME-Version 1.0
In-Reply-To <CAOFbRmJN=XicYeUjN9+a800FqvRGigA4p_88mU=Pj1ZRtcgwfw@mail.gmail.com>
References <4F332007.9080800@wisc.edu> <jgv9ps$35g$1@dough.gmane.org> <mailman.5558.1328759017.27778.python-list@python.org> <Xns9FF46B35EDFF9duncanbooth@127.0.0.1> <mailman.5588.1328798176.27778.python-list@python.org> <Xns9FF497406322duncanbooth@127.0.0.1> <CAOFbRmJLyNA=-oM3eyASVE0EzA6SrjguP7Lv1Vsj2qA4=qU-cw@mail.gmail.com> <mailman.5597.1328805384.27778.python-list@python.org> <4f3471e9$0$29986$c3e8da3$5496439d@news.astraweb.com> <CAOFbRmJN=XicYeUjN9+a800FqvRGigA4p_88mU=Pj1ZRtcgwfw@mail.gmail.com>
Date Fri, 10 Feb 2012 21:08:04 +1100
Subject Re: frozendict
From Chris Angelico <rosuav@gmail.com>
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 <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.5645.1328868491.27778.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328868491 news.xs4all.nl 6943 [2001:888:2000:d::a6]:35811
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20151

Show key headers only | View raw


On Fri, Feb 10, 2012 at 1:30 PM, Nathan Rice
<nathan.alexander.rice@gmail.com> wrote:
> The only thing needed to avoid the hash collision is that your hash
> function is not not 100% predictable just by looking at the python
> source code.  I don't see why every dict would have to be created
> differently.  I would think having the most ubiquitous data structure
> in your language be more predictable would be a priority.  Oh well....

It's perfectly predictable. If you put a series of keys into it, you
get those same keys back. Nobody ever promised anything about order.

If your hash function is not 100% predictable, that means it varies on
the basis of something that isn't part of either the Python
interpreter or the script being run. That means that, from one
execution to another of the exact same code, the results could be
different. The keys will come out in different orders.

ChrisA

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


Thread

Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-08 22:43 -0500
  Re: frozendict Duncan Booth <duncan.booth@invalid.invalid> - 2012-02-09 10:33 +0000
    Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-09 09:36 -0500
      Re: frozendict Duncan Booth <duncan.booth@invalid.invalid> - 2012-02-09 14:52 +0000
        Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-09 10:19 -0500
          Re: frozendict Duncan Booth <duncan.booth@invalid.invalid> - 2012-02-09 18:47 +0000
        Re: frozendict Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-09 09:35 -0700
          Re: frozendict Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-10 01:24 +0000
            Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-09 21:30 -0500
            Re: frozendict Terry Reedy <tjreedy@udel.edu> - 2012-02-09 22:33 -0500
            Re: frozendict Chris Angelico <rosuav@gmail.com> - 2012-02-10 21:08 +1100
            Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-10 11:53 -0500
            Re: frozendict Chris Rebert <clp2@rebertia.com> - 2012-02-10 09:00 -0800
            Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-10 13:14 -0500
              Re: frozendict John Nagle <nagle@animats.com> - 2012-02-10 10:57 -0800
                Re: frozendict 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-10 21:52 -0800
                Re: frozendict John Nagle <nagle@animats.com> - 2012-02-13 13:15 -0800
        Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-09 11:50 -0500

csiph-web