Path: csiph.com!news.swapon.de!newsreader4.netcologne.de!news.netcologne.de!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.05; 'that?': 0.05; 'brackets': 0.09; 'check.': 0.09; 'git': 0.09; 'matched': 0.09; 'precedence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'second.': 0.09; ':-)': 0.12; 'missed': 0.15; 'thu,': 0.15; 'mark,': 0.16; 'operators.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.16; 'language': 0.19; '>>>': 0.20; '2015': 0.20; 'lawrence': 0.22; 'parse': 0.22; 'am,': 0.23; 'seems': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'figure': 0.27; 'bad.': 0.29; 'quantities': 0.29; 'read,': 0.29; "we're": 0.30; 'certainly': 0.30; 'putting': 0.30; 'language.': 0.32; 'possibly': 0.32; "d'aprano": 0.33; 'steven': 0.33; 'that,': 0.34; 'fail': 0.35; 'week.': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'why': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'easy': 0.60; 'your': 0.60; 'charset:windows-1252': 0.62; 'more': 0.63; 'within': 0.64; 'our': 0.64; 'p.s.': 0.65; 'respect': 0.65; 'believe': 0.66; 'quantity': 0.66; 'saturday': 0.66; 'day': 0.67; 'counts': 0.81; 'old,': 0.83; 'evening': 0.84; 'pythonistas,': 0.84; 'subject:value': 0.84; 'subject:Check': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Check if a given value is out of certain range Date: Fri, 2 Oct 2015 00:34:47 +0100 References: <560d78e2$0$1618$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 195.147.66.69 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <560d78e2$0$1618$c3e8da3$5496439d@news.astraweb.com> 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: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1443742526 news.xs4all.nl 23759 [2001:888:2000:d::a6]:34188 X-Complaints-To: abuse@xs4all.nl X-Received-Body-CRC: 98776178 X-Received-Bytes: 5087 Xref: csiph.com comp.lang.python:97318 On 01/10/2015 19:18, Steven D'Aprano wrote: > On Thu, 1 Oct 2015 08:31 am, Mark Lawrence wrote: > >>> What is so "yuck" about that? What would you do instead? It seems like >>> the best solution to me. Easy to read, fast to execute. >>> >> >> I have to parse those damn brackets and then figure out the inverted >> logic. Give me x < 0 or x > 10 any day of the week. When you're an old, >> senile git like me, readability counts :-) > > With the greatest of respect Mark, I don't believe that for a second. Your > sig line, which you have used without fail for more years than I can > remember includes the phrase "ask not what our language can do for you". If > you can understand that, I don't believe that you cannot figure out how to > go from this: > > # x is within the range a to b > a <= x < = b > > to this: > > # x is NOT within the range a to b > not a <= x < = b > > You're certainly a senile old git if you think we're falling for that > one :-) Why do you think I never gamble at anything, it's a mug's game. > > P.S. in case you missed it, you don't actually need the params, since the > precedence of not is lower than the other operators. I confess that I did not bother to check. > > Did-I-include-sufficient-smileys-ly y'rs, > Not bad. However after the big match coming up on Saturday evening UK time one of us will possibly be putting up ginormous quantities of smileys, matched by the ginormous quantity of grimaces from the other :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence