Python "why" questions
Gregory Ewing
greg.ewing at canterbury.ac.nz
Mon Aug 16 02:53:52 CEST 2010
> On Aug 7, 2010, at 9:14 PM, John Nagle wrote:
>
>> The languages which have real multidimensional arrays, rather
>> than arrays of arrays, tend to use 1-based subscripts. That
>> reflects standard practice in mathematics.
Not always -- mathematicians use whatever starting index is
most convenient for the problem at hand. For example, the
constant term of a polynomial is usually called term 0,
not term 1. So to a mathematician, an array being used to
hold polynomial coefficents would most naturally be indexed
from 0.
I suspect that part of the reason Fortran uses 1-based
indexing is that people hadn't had enough experience with
high-level languages back then to realise the awkwardness
it often leads to, and they were relying on "common sense".
--
Greg
More information about the Python-list
mailing list