[Numpy-discussion] bug in http://www.scipy.org/NumPy_for_Matlab_Users

Charles R Harris charlesr.harris@gmail....
Sun Apr 29 16:02:09 CDT 2007


On 4/29/07, Kevin Jacobs <jacobs@bioinformed.com> <bioinformed@gmail.com>
wrote:
>
> On 4/29/07, Andrew Straw <strawman@astraw.com> wrote:
> >
> > No, the nth index of a Python sequence is a[n], where n starts from
> > zero. Thus, if I want the nth dimension of array a, I want a.shape[n].
> >
> > I reverted the page to its original form and added a couple explanatory
> > comments about zero vs one based indexing.
>
>
>
> <pedantic sounding rant -- apologies in advance>
> Those among us who value correct English will continue to insist that
> ordinal numbers begin with "first" and the concept of "zeroth" is an
> unnatural technological bastardization.  (This is not to say that zero-based
> indexing is bad -- just distinct from the ordinal.)
>

Ordinals begin with the empty set, 0, and continue 1 := {0}, 2 := {0, {0}},
3 := {0, {0}, {{0, {0}}}, ...

The first index of 'a' is 0, the first element is a[0], the second index is
> 1 and the second element is a[1], etc.  Thus, the n-th index or element, a
> contraction of ordinal numbering, is correctly and canonically written as
> a[n-1] in a zero-based index scheme.  The linguistics of "n-th" are that of
> ordinality in both English and mathematics, requiring an explicitly mapping
> to the technological concept of a given indexing syntax.
>

Fortran by default uses 1 based indexing, but uses a "magic" pointer so that
actual indexing is zero based, look at the internals of a Fortran compiler
sometime an see. I think this points out that zero based indexing is more
natural.

Glossing over that difference, especially when it contradicts the most
> natural conventions of the target audience, is unfriendly and
> counterintuitive.  The only reason why it makes sense to you only because of
> your disadvantage of already understanding that which you are trying to
> explain.
> </pedantic sounding rant>
>

I love these little flame wars, not that there aren't things I *really*
should be doing.

Chuck <http://projects.scipy.org/mailman/listinfo/numpy-discussion>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070429/e86e3012/attachment.html 


More information about the Numpy-discussion mailing list