Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(of': 0.05; '*type*': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'hash': 0.09; 'message- id:@stoneleaf.us': 0.09; 'obey': 0.09; 'received:gator410.hostgator.com': 0.09; 'to:name:python list': 0.09; 'underlying': 0.09; 'url:dev': 0.09; '~ethan~': 0.09; 'wrote:': 0.14; 'equal,': 0.16; 'furman': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'header:In-Reply-To:1': 0.21; 'objects': 0.23; 'code': 0.24; 'compare': 0.26; 'tried': 0.27; "i'm": 0.27; 'fact': 0.30; 'equal': 0.31; "didn't": 0.31; 'words,': 0.32; 'to:addr:python- list': 0.33; 'break': 0.33; 'actually': 0.33; 'things': 0.33; 'question': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'using': 0.35; '(with': 0.36; 'several': 0.36; 'comparing': 0.37; 'url:docs': 0.37; 'two': 0.37; 'url:python': 0.38; 'could': 0.38; 'url:org': 0.38; 'docs': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'said': 0.39; 'perhaps': 0.39; 'to:addr:python.org': 0.39; 'meaning': 0.40; 'happen': 0.60; 'received:websitewelcome.com': 0.67; 'received:67.18.68': 0.84; 'received:gateway15.websitewelcome.com': 0.84 Date: Fri, 20 May 2011 11:46:08 -0700 From: Ethan Furman User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: python list Subject: Re: hash values and equality References: <4DD2C2A5.3080403@stoneleaf.us> <4DD2D89D.4000303@stoneleaf.us> <4DD2F661.2050005@stoneleaf.us> <4DD5FF8F.604@stoneleaf.us> In-Reply-To: <4DD5FF8F.604@stoneleaf.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:1804 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: 25 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305916430 news.xs4all.nl 49179 [::ffff:82.94.164.166]:60619 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5870 Ethan Furman wrote: > Several folk have said that objects that compare equal must hash equal, > and the docs also state this > http://docs.python.org/dev/reference/datamodel.html#object.__hash__ Two things I didn't make clear originally: I'm using Python3. My objects (of type Wierd) obey the premise of comparing equal also meaning hashing equal (with other objects of type Wierd). Perhaps my question could be narrowed down to: Should the docs actually say that "objects of the same *type* that compare equal must hash equal", or is there an underlying reason that objects of *different types* that happen to compare equal *must not* have different hashes? In other words, is the fact that everything tried so far in Python3 to break my toy code has failed to do so just an implementation detail of Python3? ~Ethan~