Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'operator': 0.03; '(except': 0.07; 'reason,': 0.07; 'assumed': 0.09; 'check,': 0.09; 'false,': 0.09; 'false.': 0.09; "wouldn't": 0.14; 'equal.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'aug': 0.22; 'skip:l 30': 0.24; 'helpful': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'invoke': 0.31; 'quite': 0.32; 'implemented': 0.33; 'maybe': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'to:addr:python-list': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'first': 0.61; 'skip:n 10': 0.64; 'skip:r 30': 0.69; 'sorry.': 0.91; 'why?': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ls/3OEBjBTCesmsO5jSIRdxnaXTaF523g0/2diEaj28=; b=Yc2tVQL8b3OmId9EORPb/mYrDfhBo/bGMCJV+9cXO4VQFal9iSkSo9Iaf+HafjLx+e 3fv4MDX6ARBIYEKdW+qUm9pn0Maff5hLvkIxOQmhNJwwxljxwfhUmm1UMH96TOClQTkb fuQwsM5zcYWxEz5VY26msU+GYZTl8Ep2sNnwc78s2K1FphAiVeE0KvoOu5jWJAMq59pi /+52xmOpiJ4PrlKgKIzFbAhzpszyi+jJUJ8ONElEecuuAzjbMpyeF+IweC9OdyzfSEdy HMf+8hSVj9eS4WCvdvxz/5Hovzc0/muaEO2xWd1bwaZLA3bo7Bz8ZIpOai1W9wGF8Zrn 4U7g== MIME-Version: 1.0 X-Received: by 10.68.20.200 with SMTP id p8mr2664023pbe.122.1375868587980; Wed, 07 Aug 2013 02:43:07 -0700 (PDT) In-Reply-To: References: <51FED74E.6080003@markusrother.de> Date: Wed, 7 Aug 2013 10:43:07 +0100 Subject: Re: Bug? ( () == [] ) != ( ().__eq__([]) ) From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375868597 news.xs4all.nl 16012 [2001:888:2000:d::a6]:47402 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52126 On Wed, Aug 7, 2013 at 10:24 AM, Shiyao Ma wrote: > Sorry. I don't quite get it. As you said, it first tries, > leftOperand.__eq__(rightOperand) then if it returns NotImplemented, it goes > to invoke rightOperand.__eq__(leftOperand). But for any reason, [] == () > returns false, why? If neither of them has implemented a check, then it's assumed they're not equal. It wouldn't be helpful for the == operator to return anything other than True or False (except maybe NaN), so it returns False. ChrisA