Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'plenty': 0.07; 'cc:addr:python-list': 0.09; 'english,': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'exception': 0.13; 'question.': 0.13; 'wed,': 0.15; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'cc:name:python': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'message-id:@fido.openend.se': 0.16; 'readable': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'refactoring': 0.16; 'laura': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'proposed': 0.20; 'cc:2**1': 0.22; 'forms.': 0.22; 'sep': 0.22; 'pass': 0.22; 'cc:no real name:2**0': 0.22; "doesn't": 0.26; 'wonder': 0.27; 'heading': 0.27; 'yesterday': 0.27; 'received:se': 0.29; 'typically': 0.29; 'says': 0.32; 'language.': 0.32; 'class': 0.33; 'could': 0.35; 'but': 0.36; 'instead': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'say': 0.37; 'charset:us-ascii': 0.37; 'things': 0.38; 'anything': 0.38; 'your': 0.60; 'header:Message-Id:1': 0.61; 'more': 0.63; 'was:': 0.66; 'everybody': 0.67; "'not'": 0.84; 'header:In-reply-to:1': 0.84; 'mirrors': 0.84; 'subject:value': 0.84; 'supporters.': 0.84; 'subject:Check': 0.95 To: Ian Kelly cc: Python , lac@openend.se From: Laura Creighton Subject: Re: Check if a given value is out of certain range In-reply-to: References: <87si5v3hpx.fsf@elektro.pacujo.net> Comments: In-reply-to Ian Kelly message dated "Wed, 30 Sep 2015 14:46:48 -0600." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11713.1443685258.1@fido> Date: Thu, 01 Oct 2015 09:40:58 +0200 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Thu, 01 Oct 2015 09:40:59 +0200 (CEST) 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1443685269 news.xs4all.nl 23808 [2001:888:2000:d::a6]:48387 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:97269 In a message of Wed, 30 Sep 2015 14:46:48 -0600, Ian Kelly writes: >Thought mirrors language. In English, we typically would say "x is not >between 0 and 10", not "x is either less than 0 or greater than 10". I wonder if that is regional. I think you may have stacked things with the 'either' and the 'greater than'. 'Either' doesn't get used much unless you are heading for 'either x or y but not both'. And everybody says 'more' even when 'greater than' is arguably more precise. Around here, I would expect "x is less than 0 or more than 10" more often than either of your proposed forms. But yesterday I hit up the students with the 'what do you find more readable' question. There was broad consensus that: if 0 < x < 10 : do_something() else: do_something_else() was plenty more readable than anything using 'not' so that the class favourite for readability was: if 0 < x < 10: pass else: complain_out_of_range() though refactoring the whole lot so that you could have an out_of_range Exception instead of an if had a large number of supporters. Laura