In defense of 0, was Re: [Edu-sig] None potato, one potato,
two potato, more..
Terry Hancock
hancock at anansispaceworks.com
Fri Jan 2 19:49:19 EST 2004
On Friday 02 January 2004 05:13 pm, Kirby Urner wrote:
> Terry:
> > By contrast, I had endless headaches with both FORTRAN (1
> > to N) and C (1 to N-1) indexing schemes, especially with
>
> C is zero-based, like Python, no?
Yes it is. But it doesn't have anything comparable to Python's
slice notation, nor the negative indexes. So as a result you
have to think about the last element being a[len(a) - 1]. This
is technically true in Python, but I never have to call the last
element that way, I just use a[-1]. Similarly, Python range()
function interprets the values the same way as the slice notation.
Terry
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
More information about the Edu-sig
mailing list