Python Feature Request: Allow changing base of member indices to 1

Javier Bezos see_below_no_spam at yahoo.es
Sun Apr 15 19:42:13 CEST 2007


> 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 





More information about the Python-list mailing list