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

Kevin Jacobs <jacobs@bioinformed.com> bioinformed at gmail.com
Sun Apr 29 16:19:55 EDT 2007


On 4/29/07, Andrew Straw <strawman at 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.)

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.

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>

My recommendation: keep a[n-1] _and_ include a lucid discussion on
zero-based indexing.

Pedantically,
-Kevin



_______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070429/d918e9f7/attachment.html>


More information about the NumPy-Discussion mailing list