[Python-ideas] List Revolution
steve at pearwood.info
Sun Sep 11 02:37:21 CEST 2011
Guido van Rossum wrote:
> Plus pretty much every other language
> few; presumably also Objective C given its C inheritance) agrees that
> indexes start at zero. It is a cultural battle that has been fought
> and won long ago (all the old languages used 1-based indexing:
> Fortran, Algol, Pascal)
Lua appears to be a conspicuous counter-example of a relatively recent
popular language with 1-based indexing. See the (extremely incomplete!)
0-based indexes are useful for some tasks, and less useful for other
tasks. In my experience, I find that 0-based indexing is more useful
most of the time: it leads to fewer off-by-one errors.
1-based indexes are particularly well-suited for programming languages
using a natural language metaphor, usually aimed at non-programmers.
Examples include Xion, Applescript, and Inform-7.
The Ubiquity desktop appears to be aiming for a natural language
scripting language, like Applescript only more so:
More information about the Python-ideas