[Python-ideas] List Revolution

Andrew McLean lists at andros.org.uk
Mon Sep 12 21:09:07 CEST 2011


On 10/09/2011 23:34, Guido van Rossum wrote:
> It is a cultural battle that has been fought and won long ago (all the 
> old languages used 1-based indexing: Fortran, Algol, Pascal) and it's 
> really not that important in the grand scheme of things, so the status 
> quo wins. (*) I personally think 0-based indexing is better, and the 
> referenced EWD expresses why better than I could. But I'm sure that if 
> we lived in a world where 1-based indexing was the norm I'd get by 
> just fine. 
To be pedantic, Fortran *defaults* to 1 based indexing, but it lets you 
choose any initial index (on a per variable basis). This has been the 
case at least as far back as the Fortran 77 standard, possibly further 
back than that.

I'm really not seriously suggesting this... but it might be possible to 
do something similar for Python. You could add an optional initial_index 
argument (with a default of zero) to the constructor for sequence types 
and then modify any operations that involve indexing.

Andrew




More information about the Python-ideas mailing list