> Here is a document giving good reasons for indexing to start at > zero, as in Python. > http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html > The author has done a bit: > http://en.wikipedia.org/wiki/Dijkstra
Dijkstra's argument is obsolete, as it is based on how array length was computed many years ago -- if we have an array a = b..e, then the lenght of a is e-b (half open range). Good at low level programming. But a quarter of a century after we know concepts are much better than low level programming and explicit computations -- if we have an array a = b..e, then the length of a should be a.length() (or a.length(b,e)), and it is independent of arbitrary ranges, index bases, or even steps (eg, {-4, -2, 0, 2, 4}). Of course, the index base should be always the same _by default_ (individual lists could require another index base, and that's fine). Otherwise it would a mess, as you said. Javier ----------------------------- http://www.texytipografia.com -- http://mail.python.org/mailman/listinfo/python-list