Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'subject:not': 0.03; 'model,': 0.05; 'true,': 0.05; 'assuming': 0.09; 'bits': 0.09; 'encode': 0.09; 'imply': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'used.': 0.09; 'jan': 0.12; 'hashes': 0.16; 'mercurial,': 0.16; "object's": 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:key': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; 'bit': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; '(or': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'statement': 0.30; 'assumes': 0.31; 'large.': 0.31; 'probability': 0.31; 'actual': 0.34; 'computing': 0.35; 'equal': 0.35; 'objects': 0.35; 'but': 0.35; 'version': 0.36; 'false': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'algorithms': 0.60; 'more': 0.64; 'fact,': 0.69; 'internet': 0.71; 'carefully': 0.74; 'gotten': 0.74; '160': 0.84; 'received:fios.verizon.net': 0.84; 'trouble.': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Dict when defining not returning multi value key error Date: Fri, 01 Aug 2014 17:42:10 -0400 References: <53db11c1$0$29986$c3e8da3$5496439d@news.astraweb.com> <53db96bc$0$29986$c3e8da3$5496439d@news.astraweb.com> <87vbqcnrrh.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-71-175-90-87.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <87vbqcnrrh.fsf@elektro.pacujo.net> 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406929354 news.xs4all.nl 2926 [2001:888:2000:d::a6]:34163 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75502 On 8/1/2014 11:39 AM, Marko Rauhamaa wrote: > Chris Angelico : > >>> but hash(x) == hash(y) does NOT imply that x == y. >> >> Hello, pigeonhole principle :) If this were false - that is, if equal >> hashes DID imply equal objects - it would be necessary to completely >> encode an object's state in its hash, and hashes would be impossibly >> large. This would, in fact, destroy their value completely. > > Well, modern computing assumes precisely: > > hash(x) == hash(y) => x == y Assuming that a false statement is true does not make it true, and can and has gotten 'computing' into trouble. > That principle is at play with strong authentication (HTTPS et al), > version control (git et al), The principle for these applications is stronghash(x) == stronghash(y) => x == y with probability 1 (or indistinguishable from 1). For mercurial, with no treat model, a 160 bit hash is used. Internet applications need more bits and carefully vetted algorithms to hopefully make the actual principle true. -- Terry Jan Reedy