Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'value,': 0.04; 'expressions': 0.07; 'float': 0.07; '-1)': 0.09; 'assuming': 0.09; 'type,': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; "wouldn't": 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'integer,': 0.16; 'roy': 0.16; 'thursday,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; '31,': 0.24; 'cc:2**0': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; 'on,': 0.29; 'am,': 0.29; "doesn't": 0.30; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; "d'aprano": 0.31; 'equivalent.': 0.31; 'steven': 0.31; 'way?': 0.31; 'run': 0.32; 'fri,': 0.33; 'problem': 0.35; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'changing': 0.37; 'january': 0.37; 'even': 0.60; 'break': 0.61; "you're": 0.61; 'further': 0.61; 'happen': 0.63; '30,': 0.65; 'within': 0.65; 'smith': 0.68; '100%': 0.77; 'subject:True': 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=lYC5yXOV4lIp9soE8CMri37riq0ohGo8+GV1xclpOVw=; b=msue5setbY522JqliXabVQqw8T0Iwcu1lI/JewW6KCWSkC0W2gDWz6oLzH3a/Q1WOX thW5neCn533IAptEb9uF61mqLmEpwMYAdfk9q5G9xu5YPsE7EjAjQf5B/H4Yf68l5K3W mH2mi/P0EA+Us/Gk8hf537K74YIChszK280HVF9TX2hYlSTK40Z/wn9Ct5fGAuMaZB+S JHwbU6aeoTIP0epnm98giq1zD61ssgccEG3PgND09csrQdCHBQa7PZZQ6VwgzKLGj/+M OgyDHvxAkxsv4vGU0IgoLhPUYu6/KEhWGWuOoxOmQj5DmjK7gq5GU+ll7fEF7Z4Fg3vA CKsw== MIME-Version: 1.0 X-Received: by 10.68.201.10 with SMTP id jw10mr17105078pbc.25.1391120952208; Thu, 30 Jan 2014 14:29:12 -0800 (PST) In-Reply-To: References: <99b0aa22-5fb3-460a-a080-dacb1c0f2fda@googlegroups.com> <3dcdc95d-5e30-46d3-b558-afedf9723c7c@googlegroups.com> <52ea6b0f$0$29972$c3e8da3$5496439d@news.astraweb.com> <7b41606f-4027-4470-b158-62f81b4e945c@googlegroups.com> Date: Fri, 31 Jan 2014 09:29:12 +1100 Subject: Re: 1 > 0 == True -> False 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391120955 news.xs4all.nl 2977 [2001:888:2000:d::a6]:34461 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65055 On Fri, Jan 31, 2014 at 9:09 AM, Roy Smith wrote: > On Thursday, January 30, 2014 10:09:03 AM UTC-5, Steven D'Aprano wrote: >> `(x+1 > 0) and (y >= 5)` > > Me: >> this is even simpler: >> (x > -1) and (y >= 5) > > On Thursday, January 30, 2014 2:03:42 PM UTC-5, Chris Angelico wrote: >> Be careful; that's not the same thing. > > In what way? I'm assuming x is some numeric type. And further assuming it's not some humungous floating point value, so we run into precision issues. Now you're changing the problem domain :) Like I said, if it's an integer, you definitely will get the same result from each of the above; but that doesn't mean the expressions are equivalent. They just might happen to produce the same result for values within some particular domain. (I wouldn't even be 100% confident that it's valid for any numeric type, though I can't think of any float values that it would break on, and complex and int are unorderable anyway.) ChrisA