On Tue, May 21, 2013 at 6:21 PM, Jussi Piitulainen <jpiit...@ling.helsinki.fi> 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 -- http://mail.python.org/mailman/listinfo/python-list