Python "why" questions
cournape at gmail.com
Mon Aug 16 13:54:21 CEST 2010
On Mon, Aug 16, 2010 at 9:53 AM, Gregory Ewing
<greg.ewing at canterbury.ac.nz> wrote:
>> 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.
Yes, there are many engineering fields where index starts at 0. Partly
for the reason you have stated concerning polynomials, especially
since this extend to series, which are pervasive in numerical
computing. In linear algebra, though, I remember to have always noted
matrices indexes in the [1,n] range, not [0,n-1]. In general, I
suspect this is much more a tradition than any kind of very reasoned
thinking (and conversely, I find most arguments for 0-indexing and
against one-indexing rather ... unconvincing. What's awkward is when
you have to constantly change from one to the other).
More information about the Python-list