MatPy question

Huaiyu Zhu huaiyu at gauss.almadan.ibm.com
Tue Nov 20 19:22:11 EST 2001


On 20 Nov 2001 12:19:35 GMT, Uwe Schmitt <uwe at rocksport.de> wrote:
>I'd prefer indexing from one, because it's the notion used in
>mathematics, most existing algorithms are formulated this way.

Mathematicians do not really care about whether the index starts with zero
or one.  They just need some index, which could start from 42 if you want.
But when they do care, such as defining the axioms of natural numbers, they
seem to prefer starting from zero as well.

In programming, the indices are not just labels, because you actually loop
over them.  If you do not do indexing explicitly, it really does not matter
to you.  If you do a lot of index calculations, you'll find starting from
zero is much easier.

My experience is that translating algorithms to start indexing at zero is
not a big deal, and it helps a lot when debugging code.  I initially learned
programming in Fortran, but when I learned C later it felt much more
natural.  I guess some other people might feel the same way too.

Huaiyu



More information about the Python-list mailing list