Russ P. wrote:
On Aug 19, 11:42 am, Steven D'Aprano <st...@remove-this-
cybersource.com.au> wrote:
On Thu, 19 Aug 2010 11:03:53 -0700, Russ P. wrote:
For those who insist that zero-based indexing is a good idea, why you
suppose mathematical vector/matrix notation has never used that
convention? I have studied and used linear algebra extensively, and I
have yet to see a single case of vector or matrix notation with zero-
based indexing in a textbook or a technical paper. Also, mathematical
summation is traditionally shown as "1 to N", not "0 to N-1".
In my experience, it's more likely to be "0 to N" than either of the
above, thus combining the worst of both notations.

Are
mathematicians just too simple-minded and unsophisticated to understand
the value of zero-based indexing?
No, mathematicians are addicted to tradition.

That is probably true. But computer languages are addicted to more
than tradition. They're addicted to compatibility and familiarity. I
don't know where zero-based indexing started, but I know that C used
it very early, probably for some minuscule performance advantage. When
C++ came along, it tried to be somewhat compatible with C, so it
continued using zero-based indexing. Then Java was loosely modeled
after C++, so the convention continued. Python was written in C, so
zero-based indexing was "natural." So the whole thing is based on a
decision by some guy who was writing a language for operating systems,
not mathematics or application programming.

[snip]
C was derived ultimately from BCPL.

In C array indexing is syntactic sugar for pointer arithmetic with
dereferencing, so:

    p[i]

means the same as:

    *(p + i)

BCPL, IIRC, didn't use the familiar indexing syntax. !p was the
equivalent of *p and p!i was short for !(p + i), the equivalent of p[i].
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to