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: UNSURE 0.281 X-Spam-Level: ** X-Spam-Evidence: '*H*': 0.44; '*S*': 0.01; 'subject:method': 0.09; 'collections.': 0.16; 'wrote:': 0.17; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; '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; 'especially': 0.35; 'there': 0.35; '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; 'received:192': 0.39; 'called': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'subject:-': 0.40; 'think': 0.40; 'your': 0.60; 'kind': 0.61; 'different': 0.63; 'received:74.208': 0.71; 'common,': 0.84; 'different.': 0.84; 'otten': 0.84; 'received:74.208.4.194': 0.84; 'subject:Any': 0.84 Date: Fri, 18 Jan 2013 07:29:21 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Any built-in ishashable method ? References: <627444785.6706139.1358510169194.JavaMail.root@sequans.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:Dx+fzJTrrZFIcy7es4adCApWCldWeL1rlfwuoIhByfu TCh5U6RY/ENu1YuPk2MqJjspjhoBsFYV4JO5quuY1Gv2xSPHue n8ekP5MGTgfDxmItRn/u1R3S2K22gCN9rGI7AW+tvmX8yaDE7d qe/i7uyc/ozp3IWBXTgYZqJQHQ7O4G8bgAnl6ZNjquAhJJlaZ8 +FZAll4NGLaAMfIz6wFm1lvDUbKM7zxHLIHFUi2NYAM/LCYmHs afDin+pMqzt+Tp8ihEGq/zVATSaveJ/Rd/Riapm7TMa7kGs68E ozQ69HbVX4ZKCFfqVVONMTL7JPQ7S8aoXMKbBGqQRblbv6zrg= = X-Mailman-Approved-At: Sat, 19 Jan 2013 09:39:06 +0100 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358584747 news.xs4all.nl 6982 [2001:888:2000:d::a6]:43989 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37072 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. The problem is the converse of this, where the objects compare equal, but they have different hashes. -- DaveA