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


Groups > comp.lang.python > #20131

Re: frozendict

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <nathan.alexander.rice@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'cpython': 0.05; 'differently.': 0.07; 'nasty': 0.07; 'python': 0.08; 'dict': 0.09; 'am,': 0.12; 'dictionaries': 0.16; 'predictable': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'cc:addr:python-list': 0.16; 'language': 0.16; 'url:bugs': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'cc:no real name:2**0': 0.21; 'input': 0.22; 'header:In- Reply-To:1': 0.22; 'feb': 0.22; 'versions': 0.23; 'structure': 0.26; 'cc:2**0': 0.26; 'code.': 0.26; 'function': 0.27; 'random': 0.28; 'message-id:@mail.gmail.com': 0.29; 'assuming': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'hash': 0.30; 'kelly': 0.30; 'received:209.85.210.46': 0.30; 'received:mail- pz0-f46.google.com': 0.30; 'source': 0.32; 'thu,': 0.32; 'anyone': 0.32; 'there': 0.33; 'steven': 0.34; 'url:python': 0.35; 'two': 0.36; 'created': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'hold': 0.38; 'think': 0.38; 'data': 0.38; 'url:org': 0.39; 'received:209': 0.39; 'more': 0.61; 'your': 0.61; 'day': 0.68; 'order,': 0.73; 'salt': 0.77; 'serious': 0.78; '100%': 0.82; 'guarantee.': 0.84; 'nathan': 0.84; 'ubiquitous': 0.84; 'surprise': 0.97
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 :cc:content-type:content-transfer-encoding; bh=CVcOaBO3qiFEwhjJ7qsfwjbi2AAc935W+fBV+mT6Tvs=; b=sq47WYI+fO0GlXf5XYgs1JyrwJR7Q3YeE+gDj2hW6rSGo7Gj0+eEIjhRXccb6Ca7a2 VG6kx9rkvJidrjE7p1DJN8wxNMUbfAFZQr0n3wNLqVNk5bYVv6jVBzVLz02l0Me63YZk NjhEORUDQE5d2rJFt+Wo52G+4aN2WkhQ+6ikc=
MIME-Version 1.0
In-Reply-To <4f3471e9$0$29986$c3e8da3$5496439d@news.astraweb.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>
Date Thu, 9 Feb 2012 21:30:46 -0500
Subject Re: frozendict
From Nathan Rice <nathan.alexander.rice@gmail.com>
To "Steven D'Aprano" <steve+comp.lang.python@pearwood.info>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
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.5630.1328841051.27778.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328841051 news.xs4all.nl 6925 [2001:888:2000:d::a6]:44966
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20131

Show key headers only | View raw


On Thu, Feb 9, 2012 at 8:24 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Thu, 09 Feb 2012 09:35:52 -0700, Ian Kelly wrote:
>
>> On Thu, Feb 9, 2012 at 8:19 AM, Nathan Rice
>> <nathan.alexander.rice@gmail.com> wrote:
>>> As I said, two dictionaries created from the same input will be the
>>> same...
>>
>> That's an implementation detail, not a guarantee.  It will hold for
>> current versions of CPython but not necessarily for other Python
>> implementations.
>
> That day may be sooner than you think. It is very likely that in Python
> 3.3, dict order will be randomized on creation as a side-effect of adding
> a random salt to hashes to prevent a serious vulnerability in dicts.
>
> http://securitytracker.com/id/1026478
>
> http://bugs.python.org/issue13703
>
>
> If there is anyone still assuming that dicts have a predictable order,
> they're going to be in for a nasty surprise one of these days.

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....


Nathan

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