[Edu-sig] Re: In defense of 0, was Re: None potato, one potato,
two potato, more..
trent at oliphant.org
Mon Jan 5 12:25:09 EST 2004
>>> would indicate the item sitting 2cm from the beginning (c)
>>>[0:3] would indicate the items from the beginning (0) to 3 cm from the
>>>beginning (i.e. a,b,c)
>>From 0 to 2 cm from the beginning, no?
> No, though 'c' lies 2cm from the beginning, it does not fall between 0
> and 2cm because if you stop at 2cm you haven't yet passed it (since
> we're imagining each item being 1cm wide and it lies between 2cm and
> 0 a 1 b 2 c 3 d 4 e 5
So the indexing notation [n] could be considered shorthand for [n:n+1]?
You are taking a slice of len 1 starting at n?
More information about the Edu-sig