Lower bounds of lists

Dan Parisien dan at eevolved.com
Fri Mar 2 00:07:36 CET 2001


Michael Prager wrote:

> As a newcomer to Python, I'm curious about the choice to number
> list elements starting at zero, rather than one.  My impression
> is that there is no user option to change that in a specific
> program.  Correct?

correct.
 
> It seems an odd choice, as humans count from one, and Python in
> other respects seems quite logical and well thought out.

The reason this is so is historical. Writing a program involved having data 
contained in addresses in memory. Data's addresses were always offsets from 
a set address (say 5 bytes from the begining). Because of that it starts at 
zero (0 bytes from the beginning _is_ the beginning)

It's the case in a lot of programming languages as well. 

Hope this helps,
Dan



More information about the Python-list mailing list