Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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; 'operator': 0.03; 'binary': 0.05; 'subject:code': 0.07; 'indeed,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terry': 0.09; 'chained': 0.16; 'comparisons,': 0.16; 'message-id:@dough.gmane.org': 0.16; 'operation.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'true:': 0.16; 'wether': 0.16; 'jan': 0.18; '>>>': 0.18; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'in.': 0.27; 'header:X -Complaints-To:1': 0.28; 'comparison': 0.29; 'included': 0.29; 'on,': 0.30; 'sense': 0.31; '(and': 0.32; 'not.': 0.32; 'to:addr :python-list': 0.33; 'equal': 0.33; 'false': 0.35; 'received:org': 0.36; 'should': 0.36; 'usual': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'most': 0.61; 'surprise': 0.65; 'potentially': 0.66; 'believe': 0.69; '>from': 0.75; "'and'": 0.84; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: code review Date: Fri, 13 Jul 2012 19:09:20 -0400 References: <87wr2oecf6.fsf <4ff0f8e0$0$29988$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342220999 news.xs4all.nl 6972 [2001:888:2000:d::a6]:37144 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25296 >From now on, for each operator I would have to remember wether it > is a supposedly comparison operator or not. I believe the following rule is true: if a op b is True or False raises, then op is a potentially chained comparison operation. They are (not) equal (and (not) is), the 4 order comparisons, and (not) in. 'in' should be the only surprise and most confusing. >>> 1 < 3 in {3,4} True >>> 3 in {3,4} < {4} False 'and' and 'or' are not included because they do not always return a bool, and indeed, they are not binary operators in the usual sense because of short-circuiting. -- Terry Jan Reedy