Path: csiph.com!usenet.pasdenom.info!gegeweb.org!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.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.080 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:method': 0.09; 'collections.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-dialin.net': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'header:X-Complaints-To:1': 0.28; 'actual': 0.28; 'behaviour': 0.29; 'hash': 0.29; 'objects': 0.29; 'subject: ?': 0.30; 'getting': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'wrong': 0.34; 'text.': 0.35; 'especially': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'compare': 0.36; 'test': 0.36; 'quite': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'nothing': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'where': 0.40; 'subject:-': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'kind': 0.61; 'course.': 0.62; 'different': 0.63; 'expectations': 0.71; 'common,': 0.84; 'different.': 0.84; 'otten': 0.84; 'subject:Any': 0.84; 'angel': 0.93; 'won': 0.96 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Any built-in ishashable method ? Date: Sat, 19 Jan 2013 09:49:13 +0100 Organization: None References: <627444785.6706139.1358510169194.JavaMail.root@sequans.com> <50F94021.8030701@davea.name> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p5084a632.dip.t-dialin.net User-Agent: KNode/4.7.3 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358585369 news.xs4all.nl 6924 [2001:888:2000:d::a6]:50913 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37074 Dave Angel wrote: > On 01/18/2013 07:06 AM, Peter Otten wrote: >> Jean-Michel Pichavant wrote: >> >>> That brings me to another question, is there any valid test case where >>> key1 != key2 and hash(key1) == hash(key2) ? Or is it some kind of design >>> flaw ? >> >> I don't think there is a use case for such a behaviour other than >> annoying your collegues ;) >> > > Beg to differ. Nothing wrong with getting the same hash on objects that > compare different. It's called a hash collision, and is quite common, > especially in large collections. Of course. > The problem is the converse of this, where the objects compare equal, > but they have different hashes. And that I read because my expectations won over the actual text.