Python "why" questions

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Aug 20 21:29:59 EDT 2010


Russ P. wrote:
> It all boils down to personal preference, but I just find it strange
> that we would not try to make programming as consistent as possible
> with notational conventions in the literature.

It doesn't matter how much mathematical convention you quote,
your assertion that 1-based indexing is better won't convince
me, because it flies in the face of my own personal experience.

> The zero-based indexing just seemed wrong to me when I first saw it.
> I'm used to it by now, but it still doesn't seem quite right to me.
> It's almost right -- but it's off by one. I still have a habit of
> taking the "1" element when I really want the "0" element.

That may be because you haven't fully adopted 0-based indexing
into your thinking. You're trying to think in terms of 1-based
indexes and convert to 0-based when you code. If you think in
0-based indexes in the first place, many things become simpler.

-- 
Greg



More information about the Python-list mailing list