inclusive-lower-bound, exclusive-upper-bound (was Re: Range

Mikael Olofsson mikael at isy.liu.se
Fri May 11 10:34:47 EDT 2001


Andrew,

On 11-May-2001 Andrew Maizels wrote:
 >  OK, next question: why does Python start indexes at zero?  Your example
 >  would work perfectly well if the range returned [1, 2, 3, 4] and the
 >  list was indexed starting with 1.  Basically, range(4) has to produce a
 >  list of four items, we just differ on what those items should be.
 >  
 >  I'm not just being difficult; I'm trying to design my own language, and
 >  this is one of the things I have different to Python.  If I've missed
 >  something where the Python way is superior, then I might want to change
 >  my mind.
 >  
 >  The way I have things at the moment, in Pixy (my language), array
 >  indexes default to start at 1, but can be declared to any range (like
 >  Pascal).  Strings are indexed starting with 1 as well.  Is there a good
 >  reason not to do this?

What about 

  range(a,b)+range(b,c)==range(a,c) 

for resonable values of the integers a,b, and c?

/Mikael

-----------------------------------------------------------------------
E-Mail:  Mikael Olofsson <mikael at isy.liu.se>
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael               
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date:    11-May-2001
Time:    16:30:54

         /"\
         \ /     ASCII Ribbon Campaign
          X      Against HTML Mail
         / \

This message was sent by XF-Mail.
-----------------------------------------------------------------------



More information about the Python-list mailing list