Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed3a.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.038 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.01; 'else:': 0.03; 'cc:addr :python-list': 0.11; 'def': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'len(other):': 0.16; 'len(self)': 0.16; 'subject:operators': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'list:': 0.30; 'message-id:@mail.gmail.com': 0.30; 'breaking': 0.31; 'class': 0.32; 'received:google.com': 0.35; 'false': 0.36; 'pm,': 0.38; 'little': 0.38; '12,': 0.39; 'break': 0.61; 'jul': 0.74; 'ethan': 0.84; 'furman': 0.84; 'subject:Proposal': 0.91; 'to:none': 0.92 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:cc :content-type; bh=SPT0YvtL+NCWGXdh0FIzLbjjh3wLUXS/8ZH119JPofE=; b=Ka72yZAS5RYl07Oy4L4xUcUZVrbXE2SV5x5kDv70gJ/EiJkDs1ZB48Ujool+vu2H2q afk1a0VesJ47a/ULvB+6AK5SsXUu60E6EIwU/1g0bVDxUWTJBZYGApqhAFaP0V3uF8+W dBmoMZU43Hu8DgL9HU7um37Gg5d5RLnJ6mMyA8WJNCt+HsWZCOVf4iKfj8iFTjWhdPZu DLFK9mNl0pcUc7JEclrkroiSP9sELtRBq7Iu6vfRu5Xz362eb+7g1ELZlm9uOgiCM/nb AAt0GaJw1sJVbVmxmisPVq60iSFJneTjGNN4WCckb7kNiM05ncKeL3cQcINHpqDrXxGs E0Ag== MIME-Version: 1.0 X-Received: by 10.58.8.12 with SMTP id n12mr3986875vea.28.1405147175914; Fri, 11 Jul 2014 23:39:35 -0700 (PDT) In-Reply-To: <53C0D199.8070804@stoneleaf.us> References: <53bce8a3$0$2746$c3e8da3$76491128@news.astraweb.com> <53c0abe8$0$9505$c3e8da3$5496439d@news.astraweb.com> <53C0D199.8070804@stoneleaf.us> Date: Sat, 12 Jul 2014 16:39:35 +1000 Subject: Re: Proposal: === and !=== operators From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405147177 news.xs4all.nl 2867 [2001:888:2000:d::a6]:39973 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74374 On Sat, Jul 12, 2014 at 4:11 PM, Ethan Furman wrote: > class list: > def __eq__(self, other): > if len(self) != len(other): > return False > for this, that in zip(self, other): > if this is that or this == that: > continue > break > else: > return True > return False Seems a little elaborate. Why not just return straight from the loop, instead of breaking and using else? :) ChrisA