Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97269

Re: Check if a given value is out of certain range

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <lac@openend.se>
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 <ian.g.kelly@gmail.com>
cc Python <python-list@python.org>, lac@openend.se
From Laura Creighton <lac@openend.se>
Subject Re: Check if a given value is out of certain range
In-reply-to <CALwzidnomv47Ae+71mU99-+kuBUwO26endbhvM6LFBbphbq8KQ@mail.gmail.com>
References <mailman.229.1443511549.28679.python-list@python.org> <muefce$ia9$1@dont-email.me> <mueshe$9f0$1@ger.gmane.org> <mailman.252.1443578914.28679.python-list@python.org> <mugaov$79k$1@speranza.aioe.org> <muh0nf$jr0$1@reader1.panix.com> <87si5v3hpx.fsf@elektro.pacujo.net> <muhg4j$70q$1@speranza.aioe.org> <CALwzidnomv47Ae+71mU99-+kuBUwO26endbhvM6LFBbphbq8KQ@mail.gmail.com>
Comments In-reply-to Ian Kelly <ian.g.kelly@gmail.com> 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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.285.1443685269.28679.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Check if a given value is out of certain range Rob Gaddi <rgaddi@technologyhighland.invalid> - 2015-09-29 16:48 +0000
  Re: Check if a given value is out of certain range Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-29 21:32 +0100
    Re: Check if a given value is out of certain range sohcahtoa82@gmail.com - 2015-09-30 11:31 -0700
      Re: Check if a given value is out of certain range Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-30 23:31 +0100
        Re: Check if a given value is out of certain range Steven D'Aprano <steve@pearwood.info> - 2015-10-02 04:18 +1000
          Re: Check if a given value is out of certain range John Gordon <gordon@panix.com> - 2015-10-01 18:20 +0000
            Re: Check if a given value is out of certain range Steven D'Aprano <steve@pearwood.info> - 2015-10-02 05:19 +1000
              Re: Check if a given value is out of certain range John Gordon <gordon@panix.com> - 2015-10-01 19:41 +0000
                Re: Check if a given value is out of certain range Marko Rauhamaa <marko@pacujo.net> - 2015-10-01 22:59 +0300
                Re: Check if a given value is out of certain range Emile van Sebille <emile@fenx.com> - 2015-10-01 13:15 -0700
                Re: Check if a given value is out of certain range John Gordon <gordon@panix.com> - 2015-10-01 21:45 +0000
                Re: Check if a given value is out of certain range Ian Kelly <ian.g.kelly@gmail.com> - 2015-10-01 16:03 -0600
                Re: Check if a given value is out of certain range Chris Kaynor <ckaynor@zindagigames.com> - 2015-10-01 15:48 -0700
                Re: Check if a given value is out of certain range Ian Kelly <ian.g.kelly@gmail.com> - 2015-10-01 16:01 -0600
                Re: Check if a given value is out of certain range Steven D'Aprano <steve@pearwood.info> - 2015-10-03 20:29 +1000
                Re: Check if a given value is out of certain range Bartc <bc@freeuk.com> - 2015-10-03 11:48 +0100
                Re: Check if a given value is out of certain range Laura Creighton <lac@openend.se> - 2015-10-03 14:12 +0200
                Re: Check if a given value is out of certain range Steven D'Aprano <steve@pearwood.info> - 2015-10-03 23:51 +1000
                Re: Check if a given value is out of certain range wxjmfauth@gmail.com - 2015-10-03 07:19 -0700
                Re: Check if a given value is out of certain range Steven D'Aprano <steve@pearwood.info> - 2015-10-05 00:47 +1100
                Re: Check if a given value is out of certain range Rustom Mody <rustompmody@gmail.com> - 2015-10-04 19:28 -0700
                Re: Check if a given value is out of certain range Rustom Mody <rustompmody@gmail.com> - 2015-10-04 19:32 -0700
                Re: Check if a given value is out of certain range Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-10-03 11:49 -0400
          Re: Check if a given value is out of certain range Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-10-02 00:34 +0100
      Re: Check if a given value is out of certain range Michiel Overtoom <motoom@xs4all.nl> - 2015-10-05 10:18 +0200
        Re: Check if a given value is out of certain range Jussi Piitulainen <harvesting@makes.email.invalid> - 2015-10-05 13:08 +0300
          Re: Check if a given value is out of certain range Marko Rauhamaa <marko@pacujo.net> - 2015-10-05 14:42 +0300
            Re: Check if a given value is out of certain range Chris Angelico <rosuav@gmail.com> - 2015-10-06 00:10 +1100
              Re: Check if a given value is out of certain range Marko Rauhamaa <marko@pacujo.net> - 2015-10-05 16:25 +0300
      Re: Check if a given value is out of certain range Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-10-05 10:19 +0100
  Re: Check if a given value is out of certain range Random832 <random832@fastmail.com> - 2015-09-29 17:04 -0400
    Re: Check if a given value is out of certain range Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-09-30 07:57 +0200
  Re: Check if a given value is out of certain range Emile van Sebille <emile@fenx.com> - 2015-09-29 14:07 -0700
  Re: Check if a given value is out of certain range Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-29 15:07 -0600
    Re: Check if a given value is out of certain range Steven D'Aprano <steve@pearwood.info> - 2015-09-30 11:55 +1000
      Re: Check if a given value is out of certain range Random832 <random832@fastmail.com> - 2015-09-29 23:08 -0400
        Re: Check if a given value is out of certain range Steven D'Aprano <steve@pearwood.info> - 2015-09-30 13:14 +1000
          Re: Check if a given value is out of certain range Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-29 23:54 -0600
  Re: Check if a given value is out of certain range Tim Chase <python.list@tim.thechases.com> - 2015-09-29 18:44 -0500
    Re: Check if a given value is out of certain range alister <alister.nospam.ware@ntlworld.com> - 2015-09-30 09:41 +0000
      Re: Check if a given value is out of certain range John Gordon <gordon@panix.com> - 2015-09-30 15:42 +0000
      Re: Check if a given value is out of certain range Grant Edwards <invalid@invalid.invalid> - 2015-09-30 15:56 +0000
        Re: Check if a given value is out of certain range Marko Rauhamaa <marko@pacujo.net> - 2015-09-30 21:06 +0300
          Re: Check if a given value is out of certain range alister <alister.nospam.ware@ntlworld.com> - 2015-09-30 20:19 +0000
            Re: Check if a given value is out of certain range Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-30 14:46 -0600
              Re: Check if a given value is out of certain range alister <alister.nospam.ware@ntlworld.com> - 2015-10-01 08:33 +0000
                Re: Check if a given value is out of certain range Chris Angelico <rosuav@gmail.com> - 2015-10-01 18:37 +1000
                Re: Check if a given value is out of certain range alister <alister.nospam.ware@ntlworld.com> - 2015-10-01 08:48 +0000
                Re: Check if a given value is out of certain range Ian Kelly <ian.g.kelly@gmail.com> - 2015-10-01 08:14 -0600
              Re: Check if a given value is out of certain range Steven D'Aprano <steve@pearwood.info> - 2015-10-02 04:59 +1000
            Re: Check if a given value is out of certain range Laura Creighton <lac@openend.se> - 2015-10-01 09:40 +0200
            Re: Check if a given value is out of certain range Laura Creighton <lac@openend.se> - 2015-10-01 09:58 +0200

csiph-web