Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1a.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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'compiler': 0.07; 'alain': 0.09; 'line:': 0.09; 'thread': 0.14; '(either': 0.16; 'ah,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'i.e.,': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'subject:search': 0.16; 'wrote:': 0.18; 'meant': 0.20; '>>>': 0.22; 'example': 0.22; 'header:User-Agent:1': 0.23; 'stick': 0.24; 'earlier': 0.24; 'possibly': 0.26; 'signed': 0.27; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; 'chris': 0.29; 'am,': 0.29; 'forgot': 0.30; 'gives': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'fri,': 0.33; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'false': 0.36; 'thanks': 0.36; 'should': 0.36; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; "you're": 0.61; '2015': 0.84; 'basics.': 0.84; 'subject:find': 0.84; 'absolutely': 0.87; 'subject:Best': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=DZWZq5dW c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=SY9aFQKHIdAA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=qbvguEqOUGwXsfR1TbQA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 Date: Thu, 09 Apr 2015 17:40:37 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Best search algorithm to find condition within a range References: <2e3a3c01-20b3-4948-9b32-bd80ed46822b@googlegroups.com> <552460cc$0$13002$c3e8da3$5496439d@news.astraweb.com> <876196cm1e.fsf@elektro.pacujo.net> <87k2xlzknu.fsf@elektro.pacujo.net> <8738498qf7.fsf@dpt-info.u-strasbg.fr> <87fv89zd0m.fsf@elektro.pacujo.net> <87y4m1795n.fsf@dpt-info.u-strasbg.fr> <874mopzarw.fsf@elektro.pacujo.net> <87twwp76aj.fsf@dpt-info.u-strasbg.fr> <87pp7d73q8.fsf@dpt-info.u-strasbg.fr> <5526990a$0$12986$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <5526990a$0$12986$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1428597648 news.xs4all.nl 2821 [2001:888:2000:d::a6]:34354 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88739 On 2015-04-09 16:21, Steven D'Aprano wrote: > On Fri, 10 Apr 2015 01:02 am, Chris Angelico wrote: > >> On Fri, Apr 10, 2015 at 12:53 AM, Alain Ketterlin >> wrote: >>> Ouch, you're right, I tried to stick with Marko's example and forgot the >>> basics. I meant "signed ints", but the "removable" condition should be >>> something like: >>> >>> if ( x>0 && y>0 && z>> ... >>> >>> i.e., some condition that is never true (either false or undefined). >>> Thanks for the correction. >> >> Ah, yep. And yes, that's absolutely right - the compiler's allowed to >> treat that as never true. > > Am I missing something? Did you over-trim the quoting? > > How can the compiler possibly be allowed to treat x>0 && y>0 && z always false? > > x = y = 1 > z = 0 > > gives x>0 && y>0 && z Earlier in the thread there was the line: z = x+y; // all signed ints