Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'example)': 0.07; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'broken': 0.12; 'algorithm': 0.13; 'caches': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'header:In-Reply-To:1': 0.22; 'string': 0.24; 'index': 0.24; 'stefan': 0.24; 'code': 0.25; 'function': 0.27; 'hash': 0.30; 'understands': 0.30; 'anyone': 0.31; 'actually': 0.32; 'does': 0.32; 'header:User-Agent:1': 0.33; 'to:addr:python-list': 0.33; 'there': 0.33; 'nobody': 0.34; 'received:84': 0.34; 'header:X-Complaints-To:1': 0.34; 'question': 0.35; 'uses': 0.36; 'received:org': 0.37; 'using': 0.37; 'getting': 0.37; 'stable': 0.38; 'steven': 0.38; 'some': 0.38; 'url:org': 0.39; 'being': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'packages': 0.40; 'storage': 0.68; 'design.': 0.73; 'url:]': 0.84; 'stupid': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: Hash stability Date: Sun, 15 Jan 2012 11:13:56 +0100 References: <4f1107b7$0$29988$c3e8da3$5496439d@news.astraweb.com> <4F1205A7.70303@modelnine.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dslb-084-056-000-204.pools.arcor-ip.net User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111220 Thunderbird/9.0 In-Reply-To: <4F1205A7.70303@modelnine.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1326622458 news.xs4all.nl 6916 [2001:888:2000:d::a6]:43454 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19000 Heiko Wundram, 14.01.2012 23:45: > Am 14.01.2012 10:46, schrieb Peter Otten: >> Steven D'Aprano wrote: >>> How many people rely on hash(some_string) being stable across Python >>> versions? Does anyone have code that will be broken if the string hashing >>> algorithm changes? >> >> Nobody who understands the question ;) > > Erm, not exactly true. There are actually some packages out there (take > suds [https://fedorahosted.org/suds/], for example) that rely on the > hashing algorithm to be stable to function "properly" (suds uses hash() of > strings to create caches of objects/XML Schemas on the filesystem). That's a stupid design. Using a hash function that the application does not control to index into persistent storage just screams for getting the code broken at some point. Stefan