Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.092 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; 'argument': 0.05; '21,': 0.07; 'latter': 0.09; 'subject:script': 0.09; 'subject:How': 0.10; '"end"': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'picks': 0.16; 'range.': 0.16; 'subject:run': 0.16; 'subject:python': 0.16; 'index': 0.16; 'wrote:': 0.18; 'written': 0.21; 'convenient': 0.24; 'instance,': 0.24; "i've": 0.25; 'references': 0.26; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'start,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'agreed.': 0.31; 'writes:': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'two': 0.37; 'sometimes': 0.38; 'massive': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'skip:u 10': 0.60; 'read': 0.60; 'most': 0.60; 'length': 0.61; 'numbers': 0.61; 'entire': 0.61; 'range': 0.61; "you'll": 0.62; 'term': 0.63; 'today': 0.64; 'more': 0.64; '20,': 0.68; 'useful.': 0.68; 'subject:day': 0.69; 'family': 0.73; 'ranges': 0.74; '19.': 0.84; 'length;': 0.84; 'simple!': 0.91; '2013': 0.98 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:to :content-type; bh=2W6pz0zaHyGSughx1AMS9qF2K8M/X/8QoQhPjCg8DPw=; b=btyn+xPl58auU6EbtMDGhTfJJuUCeCqv7e8wTqbLHsU5smP3nIFy5mBAc+X5CZbGyU U2ivCihnLOo+qXRvRfkpw0QqmNlmwcoRf07jKc+llDeBahTFFGGRDBhIz/7uZiXzPD8w VYLTljnATpdgCidj9V3J2tGjZGcBsxtSX0+hZRcqMhqE3JlRaQ8f3uirzVyFtvKFJyro JiCyKbU46H4ghpMC9KpJ20Yb17kad8maqLPQ7A8U6x6ZVuXxFUkbfrVpjwrxEQSZ2pjP mXtxC0hMb+AIuxdizrrLoLQUrDdV2mT7flRlPrGsb8t/gJ7FxxXIw8KOOK5jiMnksFl/ 8HUg== MIME-Version: 1.0 X-Received: by 10.220.215.73 with SMTP id hd9mr547937vcb.19.1369127905982; Tue, 21 May 2013 02:18:25 -0700 (PDT) In-Reply-To: References: <20130521011220.GA62488@cskk.homeip.net> Date: Tue, 21 May 2013 19:18:25 +1000 Subject: Re: How to run a python script twice randomly in a day? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369127915 news.xs4all.nl 15904 [2001:888:2000:d::a6]:38370 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45659 On Tue, May 21, 2013 at 6:21 PM, Jussi Piitulainen wrote: > Chris Angelico writes: > >> > On 20May2013 15:05, Avnesh Shakya wrote: >> > So your call picks a number from 0..58, not 0..59. >> > Say randrange(0,60). Think "start, length". >> >> Nitpick: It's not start, length; it's start, stop-before. If the >> start is 10 and the second argument is 20, you'll get numbers from >> 10 to 19. But your conclusion is still accurate :) > > I've sometimes named the latter index "past", as in just past the > range. I'm also happy to call it just "end". The inclusive-style names > might be "first" and "last", so "past" is "last + 1". > > The length of the range from "start" to "end" is "end - start" without > a "pest" term that is either -1 or +1 though I forget which; two > consecutive ranges are from b to m, then from m to e; an empty range > is from b to b. Agreed. The inclusive-exclusive range is by far the most useful. There's unfortunately a massive case of lock-in here, but Scripture references would be ever so much more convenient as inc-exc. For instance, today in family devotions we read Galatians 2:1 - 2:21. At a glance, do you know whether that's the entire chapter? What if it were written as Galatians 2 to Galatians 3? Simple! ChrisA