Path: csiph.com!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '64-bit': 0.07; '32-bit': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:method': 0.09; 'infinite)': 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; 'sense...': 0.16; 'wrote:': 0.17; 'integer': 0.17; '>>>': 0.18; 'fairly': 0.21; 'keys': 0.22; 'sorry,': 0.22; 'header:User- Agent:1': 0.26; 'values': 0.26; 'question': 0.27; 'replace': 0.27; 'header:X-Complaints-To:1': 0.28; '(possibly': 0.29; 'behaviour': 0.29; 'hash': 0.29; 'writes:': 0.29; 'subject: ?': 0.30; 'to:addr :python-list': 0.33; 'another': 0.33; 'text.': 0.35; 'there': 0.35; 'received:org': 0.36; 'test': 0.36; 'should': 0.36; 'possible': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'subject:-': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'kind': 0.61; 'reply': 0.66; 'otten': 0.84; 'subject:Any': 0.84 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 08:53:22 +0100 Organization: None References: <627444785.6706139.1358510169194.JavaMail.root@sequans.com> <50f9f8a6.85ee440a.41aa.3094@mx.google.com> 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358582016 news.xs4all.nl 6908 [2001:888:2000:d::a6]:48158 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37064 Kushal Kumaran wrote: > Peter Otten <__peter__@web.de> writes: > >> 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 ;) >> > > It's fairly common. The set of possible keys can be much larger > (possibly infinite) than the set of possible hash values (restricted to > 32-bit or 64-bit integer values, afaict). Sorry, I misread the quoted text. If you replace key1 != key2 and hash(key1) == hash(key2) in Jean-Michel's question with key1 == key2 and hash(key1) != hash(key2) my reply should start to make sense...